home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / tclMotif-1.4 / doc / userman.tex (.txt) < prev    next >
Encoding:
Texinfo Document  |  1995-06-29  |  146.1 KB  |  3,230 lines

  1. \documentstyle[titlepage,makeidx]{article}
  2. \input epsf
  3. \pagestyle{myheadings}
  4. \advance\leftmargin -.3in
  5. \advance\textwidth   .6in
  6. \advance\topmargin  -.3in
  7. \advance\textheight  .6in
  8. \def\titles#1{\markboth{#1}{#1}}
  9. \def\tmVersion{1.0}
  10. \def\note#1{{\sloppy\marginpar{\tiny #1}}
  11. \def\sym#1{{\tt\sl #1\/}}
  12. \def\descriptionlabel#1{\hspace\labelsep #1}
  13. \def\Tcl{{\sl Tcl\/}}
  14. \def\Tk{{\sl Tk\/}}
  15. \def\Tm{{\sl Tm\/}}
  16. \def\moat{{\sl Mo\-at\/}}
  17. \def\Motif{{\sl OSF/\linebreak[0]Mo\-tif\/}}
  18. \def\XWin{{\sl X Window\/}}
  19. \def\XWinsys{{\sl the \XWin\ system\/}}
  20. \def\Xlib{{\sl Xlib\/}}
  21. \def\Xt{{\sl X toolkit\/}}
  22. %---------------------------------------------------------
  23. % Obey \par, even after an item in a description environement :
  24. \def\dopar{
  25.     \mbox{\ }\newline
  26. %---------------------------------------------------------
  27. \def\underscore{\kern.06em\vbox{\hrule width.3em}}
  28. \def\sanetty{%
  29. \catcode35=12% #
  30. \catcode36=12% $
  31. \catcode37=12% %
  32. \catcode38=12% &
  33. \catcode64=12% @
  34. \catcode91=12% [
  35. \catcode93=12% ]
  36. \catcode95=12% _
  37. \def\_{\char 95\protect\linebreak[0]}%
  38. \tt\null}% null just do nothing !
  39. \def\fulltty{\sanetty%
  40. \catcode`\{=12\catcode`\}=12\catcode92=12%
  41. \hyphenpenalty=10000\Spacingspaces\catcode`\|=0}
  42. %---------------------------------------------------------
  43. % Force spaces and tabs to produce horizontal spaces :
  44. \def\obeytabs{\catcode `\^^I=13}
  45. {\obeyspaces\obeytabs
  46. \gdef\Spacingspaces{\obeytabs\obeyspaces
  47. \let \xxspace
  48. \let^^I\xxtab
  49. \def\xxspace{\mbox{\hspace{1.2ex}}}
  50. \def\xxtab{\mbox{\hspace{4.8ex}}}
  51. %---------------------------------------------------------
  52. % Force newlines to start a new paragraph, with some further
  53. % indentation.
  54. \makeatletter
  55. {\catcode`\^^M=13%
  56.     \gdef\Newlines{%
  57.         \catcode`\^^M=13%
  58.         \def^^M{\xxnewline}%
  59.         \ignorespaces\@gobblecr%
  60. {\catcode `\^^I=13
  61. \gdef\ignoretabs{\@ifnextchar    {\@gobble}{\ignorespaces}}
  62. \makeatother
  63. \def\xxnewline{\par\noindent\mbox{\hspace{8ex}}\ignoretabs}
  64. \def\DontIgnoreSpace{
  65.     \def\ignoretabs{}
  66. %---------------------------------------------------------
  67. % The nastiest part: create command to parse Tcl codes, despite
  68. % the collision between Tcl and TeX macro chars.
  69.     \catcode `\|=0  |catcode `|[=1  |catcode `|]=2
  70.     |catcode `|\=12 |catcode `|{=12 |catcode `|}=12
  71.     |catcode `|>=12 |catcode `|<=12 |catcode `|#=11
  72.     |catcode `|%=6
  73.     |gdef|xxtclmode%1\end{tclmode}[%1|end[tclmode]|par]
  74.     |gdef|xxtclmodestar%1\end{tclmode*}[%1|end[tclmode*]|par]
  75. ] % This is the matching brace !
  76. %---------------------------------------------------------
  77. % The Tcl mode environment.
  78. % This mode ignore tab/space at begin of line. If you
  79. % want to keep them either use the * variation, or
  80. % add a | from where you want to keep them.
  81. \def\tclmode{
  82.     \begingroup
  83.     \fulltty\Newlines\xxnewline
  84.     \xxtclmode
  85. \let\endtclmode=\endgroup
  86. \makeatletter
  87. \@namedef{tclmode*}{
  88.     \begingroup
  89.     \fulltty\Newlines\DontIgnoreSpace
  90.     \xxtclmodestar
  91. \@namedef{endtclmode*}{\endtclmode}
  92. \makeatother
  93. %---------------------------------------------------------
  94. % Include a file, in Tcl environment.
  95. \def\ttinclude #1{
  96.     \begingroup
  97.     \Newlines\fulltty\DontIgnoreSpace
  98.     \xxnewline
  99.     \input #1
  100.     \endgroup
  101. %---------------------------------------------------------
  102. % Moat command/call back/resource definition.
  103. \def\cmd#1{{\rm\tt #1}}
  104. %---------------------------------------------------------
  105. % Import a EPSF file, and draw a frame around it.
  106. \def\windowdump#1{\fbox{\epsfbox{examples/#1.epsf}}}
  107. \def\window#1{\par
  108.     \begin{center}
  109.         \leavevmode\windowdump{#1} \\
  110.     \end{center}\par
  111. \def\example#1{
  112.     \begin{center}
  113.         (screen display)
  114.     \end{center}
  115.     \ttinclude{examples/#1.tcl}
  116.     \begin{center}
  117.         (the corresponding \moat\ script)
  118.     \end{center}
  119. \def\figureexample#1#2{
  120.     \begin{figure}[htbp]
  121.         \example{#1}
  122.         \caption{#2}
  123.         \label{fig:#1}
  124.     \end{figure}
  125. %---------------------------------------------------------
  126. % Generation transparente (\id[xyz]) ou non (\myindex[xyz]) de
  127. % l'index.
  128. \makeatletter
  129. \def\defx#1{\gdef\@mainidxentry{#1}}
  130. \defx{}
  131. \def\myindexx#1{
  132.     \defx{#1}
  133.     {\sanetty\index{#1@{\tt #1}}}
  134. \def\myindexy#1{
  135.     {\sanetty\index{{\@mainidxentry}@{\tt \@mainidxentry}!{#1}@{\tt #1}}}
  136. \def\idx#1{{\tt #1}\protect\myindexx{#1}}
  137. \def\idy#1{{\tt #1}\protect\myindexy{#1}}
  138. \def\indexeditem#1#2{
  139.     \index{#1@#2}\defx{#2}
  140.     \item[#2] \dopar
  141. \makeindex
  142. %---------------------------------------------------------
  143. \def\co{$^{\mbox{co}}$}
  144. \def\ro{$^{\mbox{ro}}$}
  145. \def\cro{$^{\mbox{cro}}$}
  146. %---------------------------------------------------------
  147. % Define the resource table environement
  148. \def\rsrctable#1{
  149.     % \begin{figure}[htbp]
  150.     \begin{center}
  151.     \label{rsrc:#1}
  152.     \begin{tabular}{lcl}
  153.   \cmd{#1} resource name    & default value & type or legal values \\
  154.   \hline%------------------------------------------------------------
  155. \def\endrsrctable{
  156.     \end{tabular}\end{center}
  157.     % \end{figure}
  158. %---------------------------------------------------------
  159. \begin{document}
  160. \titles{}
  161. \title{    A Tentative User and Reference Manual \\
  162.             for TclMotif \tmVersion
  163. \author{
  164.     Jean-Dominique Gascuel, iMAGIS/IMAG, Grenoble, France \\
  165.     {\tt Jean-Dominique.Gascuel@imag.fr} \\[2mm]
  166.     Jan Newmarch, University of Canberra, Australia \\
  167.     {\tt jan@pandonia.canberra.edu.au} \\[2mm]
  168. \maketitle
  169. %------------------------------------------------------------------------
  170. \section*{Introduction}
  171. \titles{Intro}
  172. TclMotif, alias Tm, is a binding of the \Tcl\ language%
  173. \footnote{
  174.     For more information on \Tcl\  and \Tk, see the very neat book
  175.     written by their author,
  176.     ({\sl An Introduction To Tcl and Tk}, J. Ousterout, Addison-Wesley, 1994)
  177. } to the \Motif\  widgets.
  178. \Tcl\ is an interpreted language originally intended for use as a command
  179. language for other applications. It has been used for that, but has also
  180. become useful as a language in its own right.
  181. \Tcl\ has been extended by a set of widgets called \Tk. The \Tk\ widgets are not
  182. based on the \Xt\ intrinsics, but are built above \Xlib. They allow an easy
  183. way of writing \XWin\  applications.
  184. The standard set of widgets in the X world is now the \Motif\  set. This forms
  185. a large set of widgets, and these have been through a large amount of
  186. development over the last five years. Use of this set is sometimes a
  187. requirement by business, and other widget sets try to conform to them in
  188. appearance and behavior.
  189. Furthermore, you are sometimes faced with toolkits that use \Xt-based widgets. 
  190. In this case, you have to
  191. use a \Xt\ compatible interface builder.
  192. \Tm\ allows the programmer to use the \Motif\  widgets instead of the
  193. \Tk\ widgets from \Tcl\  programs. This increases programmer choices, and allows
  194. comparison of the features of both \Tcl\  and the \Tk/\Motif\  style of widget
  195. programming.  The binding gives the usefull subset of the \Motif\ widgets, 
  196. accessible through the simple interpreted \Tcl\ language.
  197. %-------------------------------------------------------------------------
  198. \subsection*{Acknowledgments}
  199. \Tm\ is based on \Tk\ for the style of widget programming. This was
  200. because it provides a good model, but it also allows the \Tcl\  programmer to
  201. move relatively easily between \Tk\ and \Motif\  programming. An alternative
  202. style of binding to \Motif\  is used in the WKSH system, which performs a
  203. similar sort of role for the Korn Shell. An intermediate style is provided
  204. by the {\sl Wafe\/} \Xt-based frontend based on \Tcl.
  205. \medskip
  206. As I'm trying to understand \Tm\ in deep, I started to insert my 
  207. own notes in the user manual provided by Jan Newmarch.
  208. As time is going, this notes becomes more and more important,
  209. and I decided that they may end-up in a usefull user and reference manual
  210. for \Tm.
  211. They are just my own interpretation of the Scriptures.
  212. %-------------------------
  213. \subsection*{Reading this manual}
  214. The first section, {\em Getting Started}, might be sufficient for programmers 
  215. very familiar both with \Motif\ and \Tcl.
  216. \Tcl\ beginners should start by reading the Ousterout book defining 
  217. Tcl~7.
  218. \medskip
  219. The second part, starting at section 2~{\em Basics}, is a description 
  220. of all the basics \Motif\ concepts, intented for \Motif\ beginners.
  221. \medskip
  222. The last part of this manual, starting from section~\ref{sec:abstracts} 
  223. have been written to be a full reference manual of \Tm, with meaningfull 
  224. examples, all supported resources, default values, ...
  225. \medskip
  226. Finally, the {\bf index} page~\pageref{index} should provide an extensive 
  227. and easy crossreference of all supported features.
  228. %-------------------------------------------------------------------------
  229. \section{Getting Started}
  230. \titles{Getting Started}
  231. \Tcl/\Motif\  programs may be run by the \moat\ (MOtif And \Tcl) interpreter.
  232. When called with no arguments it reads \Tcl\ commands from standard input.
  233. \noindent
  234. When called by
  235. \begin{center}
  236.     \cmd{moat file-name}
  237. \end{center}
  238. it reads \Tcl\ commands from \cmd{file-name}, executes them and then enters the
  239. \moat\ event loop.  This is similar to the \Tk\ `wish' and the concept was
  240. borrowed from there.
  241. Depending on your shell interpreter, you will probably be able to run
  242. \Tcl -- \Motif\  programs as stand alone programs. If your \moat\ interpreter is
  243. installed in \cmd{/usr/local},
  244. make this the first line of your executable program~:
  245. \begin{tclmode}
  246.     #!/usr/local/bin/moat
  247. \end{tclmode}
  248. %----------------------------
  249. \subsection{A simple example}
  250. \titles{A simple example}
  251. The following example is in the programs directory as \cmd{progEG}.
  252. The typical structure of a \Motif\ program is that the top-level object is a
  253. mainWindow. This holds a menu bar, and a container object such as a form or
  254. a rowColumn which in turn holds the rest of the application objects. So a
  255. mainWindow with a list and some buttons in a form would be created by
  256. \begin{tclmode}
  257.     xtAppInitialize -class Example
  258.     xmMainWindow .main
  259.     xmForm .main.form
  260.     xmList .main.form.list
  261.     xmPushButton .main.form.btn1
  262.     xmPushButton .main.form.btn2
  263. \end{tclmode}
  264. The \cmd{xmForm} acts as what is called the ``workWindow'' of the mainWindow. 
  265. This resource would be set by
  266. \begin{tclmode}
  267.     .main setValues -workWindow .main.form
  268. \end{tclmode}
  269. \noindent
  270. Values would also be set into the list and buttons:
  271. \begin{tclmode}
  272.     .main.form.list setValues \
  273.         -itemCount 3 \
  274.         -items "one, two, three" \
  275.         -selectionPolicy single_select
  276.     .main.form.btn1 setValues -labelString Quit
  277.     .main.form.btn2 setValues -labelString "Do nothing"
  278. \end{tclmode}
  279. \noindent
  280. Geometry would be set for the form, to put the objects in their correct
  281. relation to each other. Suppose this is the list on the left, with the two
  282. buttons one under the other on the right:
  283. \begin{tclmode}
  284.     .main.form.list setValues \
  285.         -topAttachment attach_form \
  286.         -leftAttachment attach_form \
  287.         -bottomAttachment attach_form
  288.     .main.form.btn1 setValues \
  289.         -topAttachment attach_form \
  290.         -leftAttachment attach_widget \
  291.         -leftWidget .main.form.list
  292.     .main.form.btn2 setValues \
  293.         -topAttachment attach_widget \
  294.         -topWidget .main.form.btn1 \
  295.         -leftAttachment attach_widget \
  296.         -leftWidget .main.form.list
  297. \end{tclmode}
  298. \noindent
  299. Once evrything has been correctly setup, we can tell \Motif\ to 
  300. manage all the widgets, so that they will be shown on screen~:
  301. \begin{tclmode}
  302.     .main manageChild
  303.     .main.form manageChild
  304.     .main.form.list manageChild
  305.     .main.form.btn1 manageChild
  306.     .main.form.btn2 manageChild
  307. \end{tclmode}
  308. \noindent
  309. The behaviour of our application would be set by callback functions~:
  310. \begin{tclmode}
  311.     .main.form.btn1 activateCallback {exit 0}
  312.     .main.form.list singleSelectionCallback {
  313.         puts stdout "Selected %item"
  314. \end{tclmode}
  315. \noindent
  316. And finally, windows are created and the main event loop is entered:
  317. \begin{tclmode}
  318.     . realizeWidget
  319.     . mainLoop
  320. \end{tclmode}
  321. \noindent
  322. Once entered in the main event loop, the application is really running :
  323. widgets are created, displayed, and manipulated accordingly to user events
  324. that trigger the associated callbacks.
  325. %-----------------------------
  326. \subsection{What next ?}
  327. {\em Thou shall read this manual !}
  328. \medskip
  329. \Tm\ resource names stick to usual \Motif\ name with a leading {\tt -} replacing
  330. the {\tt XmN} prefix.
  331. The \Tm\ constants are specified by their \Motif\ name,
  332. without the {\tt Xm\_} prefix, either in upper 
  333. or lower case.
  334. %-------------------------------------------------------------------------
  335. \section{Basics}
  336. \titles{Basics}
  337. \Motif\ use a hierarchy of sub-windows to create interface elements,
  338. such as menu item, push button or text entry fields.
  339. In the \Xt\  and \Motif\  jargon, they are called ``widgets''%
  340. \footnote{
  341.     Widget stands for window objects.
  342. Widgets are just those visual objects that can be seen on the screen,
  343. or interacted width by the mouse or keyboard.
  344. They are organized in a hierarchy, with the application itself
  345. forming the its root.
  346. Programming a graphic user interface mainly consists of the following
  347. steps~:
  348. \begin{itemize}
  349.     \item
  350.         Creating all the widgets you needs, in a suitable hierarchy.
  351.     \item
  352.         Configuring colors, sizes, alignments, fonts, ...
  353.         In \Motif, widget get their configuration options
  354.         from so called resources.
  355.         These resources may be set on a per widget basis 
  356.         or on a per widget class basis 
  357.         (e.g. "all push buttons should have red background").
  358.         Furthermore, \Motif\  provides inheritance between
  359.         widget classes (for instance, push button have a background color 
  360.         resource, because they  inherit its existance (but not its value) from Label, 
  361.         which inherits it from Primitive, which inherits it from Core).
  362.         Usually, applications provide defaults resources for
  363.         widget classes,
  364.         and each user modify some of them on a per session basis 
  365.         (file \cmd{\~/.Xdefaults}).
  366.     \item
  367.         Programming your interface to react to user inputs~:
  368.         what function should be called when the save button is pushed ?
  369.         In \Motif\  jargon, you add ``callbacks'' to widgets.
  370.         A call back is a fragment of \Tcl\  code which is executed on 
  371.         a dedicated event (for instance, 
  372.         execute \cmd{\{puts stdout "Hello World"\}} when the mouse
  373.         button 1 is released over the ``push~me" button).
  374. \end{itemize}
  375. The following sections will detail all this concepts.
  376. \subsection{Widget Names}
  377.     \index{widget path names}
  378. \Tcl\ is a string based language (the only data type is string),
  379. and widget are organized in a hierarchical structure.
  380. To accommodate this, the naming of objects within this
  381. hierarchy is similar to the ``absolute
  382. path names'' of Unix files with a `{\tt .}' replacing
  383. the `{\tt /}' of Unix.
  384. The application itself is known as `{\tt .}'.
  385. A Form in the application may be known as `{\tt .form1}'.
  386. A Label in this form may be `{\tt .form1.okLabel}', and so on.
  387. Note that \Xt\ requires that `{\tt .}' can only have one child
  388. (except for dialogs, which are not mapped inside their parents).
  389. This naming convention is the same as in \Tk.
  390. \subsection{Widget creation commands}
  391. Widgets belong to classes, such as Label, xmPushButton or
  392. List.  For each class there is a creation command which
  393. takes the pathname of the object as first argument with
  394. optional further arguments:
  395. \begin{center}
  396.     \sym{creationCommand} \sym{widgetName} ?\cmd{managed}? \sym{resourceList}
  397. \end{center}
  398. \noindent where~:
  399. \begin{description}
  400.     \item[\sym{creationCommand}] \dopar
  401.         is the class of the widget your are creating.
  402.         Basically, all the \Motif\ 
  403.             \cmd{Xm\-Create\-SomeWidget()}
  404.         calls should be binded to a \cmd{xmSomeWidget}
  405.         \moat\ command.
  406.         The extensive list of currently supported creation command
  407.         is given below.
  408.     \item[\sym{widgetName}]\dopar
  409.         the full path name of the new widget. Note that
  410.         this specify both the parent widget (which
  411.         should already exists), and the name of the new
  412.         child.
  413.     \item[\cmd{managed}]\dopar
  414.         Before a widget can be displayed, it must be brought under 
  415.         the geometry control of its parent (similar to placing a \Tk\ widget).
  416.         This can be done by the \cmd{manageChild} widget method,
  417.         or by using the \idx{managed} argument at creation time.
  418.         If present, this option should be the first one.
  419.         A widget might be managed but unmaped, in which case it is
  420.         invisible (see \cmd{-mapedWhenManaged}, page~\pageref{rsrc:Core}).
  421.         The main use of ``not yet managed widget" are menus 
  422.         (when they are not visible),
  423.         and sub-widgets which will resize to an unknown
  424.         dimension at the time of creation of their parents.
  425.     \item[\sym{resourceList}]\dopar
  426.         An optional succession of resource name/ string\_value pairs.
  427. \end{description}
  428. \noindent For instance :
  429. \begin{tclmode}
  430.     xmForm  .form1 managed
  431.     xmLabel .form1.okLabel managed
  432.     xmPushButton .form1.cancelButton managed \
  433.         -labelString "Get rid of me"
  434. \end{tclmode}
  435. \noindent
  436. creates a Form \cmd{form1} as child of `\cmd{.}', a label
  437. \cmd{okLabel} and a push button \cmd{cancelButton} as children of \cmd{form1}.
  438. The \cmd{cancelButton} has additional arguments that set the
  439. labelString to ``Get rid of me".
  440. The set of classes generally mirrors the \Motif\  set.
  441. Some widgets in \Motif\ and \Xt\ are not accessible from
  442. this binding because they are intended for use in
  443. inheritance only, such as Core, Shell and Primitive.
  444. Gadgets, a \Motif\ variation of widgets, designed to cope with
  445. early very slow X window server is not supported too, because
  446. are not needed any more.
  447. \medskip
  448. The following basic widget will be detailed in section
  449. \ref{sec:basic}~:
  450. \begin{center} \begin{tabular}{ll|ll}
  451.     \hline%-------------------------------------------------
  452.     \cmd{xmPushButton}     & a simple button,        &    \cmd{xmLabel}         & a fixed piece of text \\
  453.     \cmd{xmArrowButton} & with an arrow face,    &    \cmd{xmTextField}    & one line text editor \\
  454.     \cmd{xmToggleButton}& with an on/off box,    &    \cmd{xmText}         & a full text editor \\
  455.     \cmd{xmDrawnButton} & with user graphics,    &    \cmd{xmList}         & a list selector, \\
  456.     \cmd{xmFrame}         & a 3-D border,            &    \cmd{xmScale}         & a slider on a scale \\
  457.     \cmd{xmSeparator}     & a simple line,        &    \cmd{xmScrollBar}    & horizontal or vertical \\
  458.     \hline%-------------------------------------------------
  459. \end{tabular} \end{center}
  460. Manager widgets are used to layout several widgets together.
  461. Placing widgets inside widgets enable to create hierarchies suitable
  462. for complex user interface design.
  463. Section \ref{sec:managers} will discuss the following manager
  464. widgets~:
  465. \begin{center} \begin{tabular}{ll}
  466.     \hline%-------------------------------------------------
  467.     \cmd{xmBulletinBoard}     & simple x,y layout, \\
  468.     \cmd{xmForm}             & layout widgets with realtional constraints, \\
  469.     \cmd{xmRowColumn}         & for regular geometry management, \\
  470.     \cmd{xmPanedWindow}     & multiple panes separated by sashes \\
  471.     \hline%-------------------------------------------------
  472. \end{tabular} \end{center}
  473. Section \ref{sec:menus} present special widgets to build menus.
  474. They may contain any flavor of button, separator, or other
  475. widgets, in addition to the following~:
  476. \begin{center} \begin{tabular}{ll}
  477.     \hline%-------------------------------------------------
  478.     \cmd{xmMenuBar}        & a row-Column used to create an horizontal menu. \\
  479.     \cmd{xmPulldownMenu}    & a row-Column used to create a vertical menu. \\
  480.     \cmd{xmPopupMenu}        & a menu on its own (transient) window. \\
  481.     \cmd{xmCascadeButton} & a special pushbutton to call a sub-menu. \\
  482.     \hline%-------------------------------------------------
  483. \end{tabular} \end{center}
  484. \Motif\ provides the following more complicated widgets.
  485. They are composed of several graphic entity, but nearly alway appear 
  486. as a unique widget.
  487. Their \moat\  binding will be detailed in section \ref{sec:complex}
  488. \begin{center} \begin{tabular}{ll}
  489.     \hline%-------------------------------------------------
  490.     \cmd{xmScrolledWindow}     & for displaying a clip view over another widget, \\
  491.     \cmd{xmScrolledList}     & a partial view of a list, \\
  492.     \cmd{xmScrolledText}     & a partial view of a text, \\
  493.     \cmd{xmMainWindow}        & contains the main application windows, a menu bar, ... \\
  494.     \cmd{xmCommand}         & a command entry area with a history list, \\
  495.     \cmd{xmMessageBox}         & message display area on its own window, \\
  496.     \cmd{xmSelectionBox}    & A list to select from. \\
  497.     \cmd{xmFileSelectionBox} & selection of a file from a list. \\
  498.     \hline%-------------------------------------------------
  499. \end{tabular}\end{center}
  500. \Motif\ also has convenience functions to create
  501. dialogs.  These don't create ordinary widgets, but
  502. \Motif\ pretends that they do.
  503. They appear in their own (transient) window, and have 
  504. push buttons at the bottom line (Ok/Cancel/...).
  505. \moat\ follows this, and the following dialogs will be described
  506. in section \ref{sec:Dialogs}.
  507. \begin{center}\begin{tabular}{ll}
  508.     \hline%-------------------------------------------------
  509.     \cmd{xmBulletinBoardDialog} & a dialog with arbitrary contents. \\
  510.     \cmd{xmFormDialog}            & a dialog based on form \\
  511.     \cmd{xmMessageDialog}       & a dialog showing a message \\
  512.     \cmd{xmInformationDialog}   & a dialog displaying information \\
  513.     \cmd{xmPromptDialog}        & a dialog with a prompt area \\
  514.     \cmd{xmQuestionDialog}      & a dialog asking a question \\
  515.     \cmd{xmWarningDialog}       & a dialog showing a warning \\
  516.     \cmd{xmWorkingDialog}       & a dialog showing a busy working message \\
  517.     \cmd{xmSelectionBoxDialog}  & a dialog based on xmSelectionBox \\
  518.     \cmd{xmFileSelectionDialog} & a dialog based on xmFileSelectionBox \\
  519.     \hline%-------------------------------------------------
  520. \end{tabular}\end{center}
  521. When you have to destroy such widgets, you must destroy the
  522. real dialog widget, that is to say the parent of the usually
  523. manipulated widget~:
  524. \begin{tclmode}
  525.     xmQuestionDialog .askMe managed
  526.     [.askMe parent] destroyWidget
  527. \end{tclmode}
  528. \subsection{Widget methods}
  529. \label{sec:wcmd}
  530.     \index{widget methods}
  531. Creating a widget actually creates a \Tcl\  command known by its
  532. path name.
  533. This command should be executed with at least one parameter to
  534. either change the behavior of the object or the value of its
  535. components, or to get information about the object.
  536. The first parameter acts like a ``method'' to the object, and
  537. specifies an action that it should perform.
  538. The general syntax is~:
  539.     \begin{center}
  540.         \sym{targetWidgetName} \hspace{2mm}
  541.         \sym{widgetCommand} \hspace{2mm}
  542.         \sym{?options?}
  543.     \end{center}
  544. as in the following examples~:
  545. \begin{tclmode}
  546.     .root.label manageChild
  547.     .root setValues -title "Hello world"
  548. \end{tclmode}
  549. \Motif\ uses the concept of inheritance for resources (see 
  550. section~\ref{sec:resources}) and translations (see 
  551. section~\ref{sec:translations}).
  552. \moat\ extend this to methods, which call \Motif\ 
  553. function on the target widget.
  554. \subsection{Widget resources}
  555. In \Motif\ jargon ``resources'' are variables shared between
  556. the widgets and the application.
  557. Their default value enable to easily handle common look and
  558. deal across application.
  559. They are also used to communicate information between the 
  560. application and the interface.
  561. Section \ref{sec:resources} will describe resource concepts,
  562. default value policy and types.
  563. A set of resources, common to many widget, will be described in
  564. section~\ref{sec:abstracts}.
  565. \subsection{Widget actions and callbacks}
  566. A user interface have to react to user inputs such as a mouse
  567. click, or a key stroke.
  568. As a particular user input may takes effects both on the interface
  569. and on the application, the reactions may be of two kinds~:
  570. \begin{description}
  571.     \item[\bf Actions:] \dopar
  572.         are behavior internal to \Motif that manage the interface.
  573.     \item[\bf Callbacks:] \dopar
  574.         are defined by the application. They are used to trigger
  575.         application's responses to user input.
  576. \end{description}
  577. Each widget class may define a set of Actions and Callbacks.
  578. \medskip
  579. Section~\ref{sec:actions} deals with actions and translations,
  580. section~\ref{sec:callbacks} will present the main callback concepts,
  581. and section~\ref{sec:abstracts} the set of actions and callbacks
  582. common to many supported \moat\ widgets.
  583. \subsection{Translations}
  584. In \Motif, reaction to user input are defined from a high level
  585. point of view~: basic actions includes arming a button, selecting
  586. a list item, setting input focus to a particular widget.
  587. On the other hand, basic events are mouse clicks,
  588. keystroke and modifier key state, etc. when the mouse is
  589. over some widget.
  590. \Motif use ``translations'' table to bind the later to the
  591. former.
  592. \subsection{The root widget}
  593. In earlier versions than 0.8, a specialised interpreter was used, much like
  594. \Tk's ``wish''.
  595. To conform to the new extension methods of tcl7.0, this was changed.
  596. Part of the result of this is that the \Xt\ world has to be explicitly
  597. brought into existence.
  598. This also allows the class and fallback resources to be set,
  599. and leaves hooks for things like setting the application icon
  600. to be added later to this binding.
  601. The world manipulation function added is~:
  602. \begin{description}
  603.     \index{class@\cmd{-class}}
  604.     \index{fallback@\cmd{-fallback\_resources}}
  605.     \indexeditem{xtappinitialize}{\cmd{xtAppInitialize}}
  606.         it may take parameters of \cmd{-class} and \cmd{-fallback\_resources}.
  607.         If the class option is omitted, the binding will deduce a class
  608.         by capitalising the first letter of the application name,
  609.         and -- if it was an `x' -- also capitalising the second letter.
  610. \end{description}
  611. \bigskip
  612. Subsequently, a bunch a root widget methods have been added to deals with
  613. \Motif\ features related only to the main application window.
  614. These are~:
  615. \begin{description}
  616. \indexeditem{mainloop}{\cmd{. mainLoop}}
  617.     this will start the application main loop, waitting for and
  618.     managing events.
  619. \indexeditem{getappresources}{\cmd{. getAppResources} \sym{rsrc\_list}}
  620.     Get the application resources. \sym{rsrc\_list} is a \Tcl list
  621.     of quadruples \cmd{\{ \sym{name} \sym{class} \sym{default} \sym{var} \}},
  622.     where \sym{name} is the name of the resources, \sym{class} their class.
  623.     For each defined resource, it search a value in the application default,
  624.     or in the resource database, and set the \Tcl variable \sym{var}
  625.     accordingly. If not found, it sets \sym{var} to \sym{default}.
  626. \indexeditem{processevent}{\cmd{. processEvent}}
  627.     Process a single event (blocking if none are present).
  628.     This is usefull only if you want to design your own main event loop.
  629. \index{stdin@\cmd{stdin}}
  630. \index{addinput}{\cmd{. addInput} \sym{fileId} \sym{perm} \sym{tclProc}}
  631.     This will add an input handler to moat.
  632.     \sym{fileId} may be one of \cmd{stdin}, \cmd{stdout}, \cmd{stderr},
  633.     or a valid opened file, as returned by \cmd{open}.
  634.     \sym{perm} is a sinle character permision, which might be
  635.     \cmd{r}, \cmd{w}, or \cmd{x} respectively for read, write or exception.
  636.     \sym{tclProc} is the tcl code that will be executed when i/o is
  637.     ready.
  638.     For instance, the  followin example add an interpreter that read and
  639.     execute \moat com\-mands when they are typped in while the interface is
  640.     running~:
  641.     \begin{tclmode}
  642.     # Define the interpret function, that handle error.
  643.     proc interpret {line} {
  644.         set code [catch {uplevel $line} result]
  645.         if {$code == 1} then {
  646.             puts stderr "$result in :\n\t$line"
  647.         } else {
  648.             if { $result != "" } {puts stderr $result}
  649.         puts stderr "% " nonewline
  650.     # Bind it as an input handler.
  651.     . addInput stdin r {
  652.         interpret [gets stdin]
  653.     # And display the first prompt
  654.     puts stderr "% " nonewline
  655.     \end{tclmode}
  656. \index{removeinput}{\cmd{. removeInput} \sym{inputId}}
  657.     Remove the input handler specified by the given identifier.
  658.     Identifier are uniq string returned by the corresponding
  659.     \cmd{addInput} call.
  660. \index{timer@Timer}
  661. \index{addtimer}{\cmd{. addTimer} \sym{interval} \sym{tclProc}}
  662.     Add a timer that will trigger ther execution of the 
  663.     given \Tcl\ after the specified interval.
  664. \index{removetimer}{\cmd{. removeTimer} \sym{timerId}}
  665.     Remove the timer specified by the given identifier. Timer
  666.     identifier are uniq string returned by the corresponding
  667.     call to \cmd{addTimer}.
  668. \end{description}
  669. %--------------------------------------------------------------------
  670. \section{Resources}
  671. \titles{Resources}
  672. \label{sec:resources}
  673. \index{resources}
  674. Resources are inherited through the class hierarchy, they have default
  675. values, and several different types.
  676. In \Motif, several base classes exist, from which actual widgets are
  677. derived. Those classes define a common set of resources, methods
  678. and behaviors.
  679. %--------------------------
  680. \subsection{Resource inheritance}
  681. Each widget belongs to a class, whose name is the widget creation
  682. command name.
  683. Each widget inherits resources from its super-class. For example, \cmd{xmLabel} is a
  684. subclass of \cmd{Primitive} which in turn is a subclass of \cmd{Core}.  
  685. From \cmd{Core} it
  686. inherits resources such as \cmd{-background}, \cmd{-height} and \cmd{-width}.
  687. From \cmd{Primitive} it
  688. inherits resources such as \cmd{-foreground}.
  689. It is necessary to look at these super-classes to have the full
  690. resource list of a \cmd{xmLabel} instance.
  691. In addition, each class adds extra resources.
  692. For example, \cmd{xmLabel} has the additional resources \cmd{-labelType}, 
  693. \cmd{-labelPixmap} and \cmd{-labelString}, among others.
  694. Some special resource values are inherited through multiple level of the
  695. widget hierarchy at creation time. For instance, the \cmd{-buttonFontList}
  696. of a bulletin board might be inherited from the \cmd{-defaultFontList}
  697. of an ancestor sub-classing the abstracts classes \cmd{vendorShell} 
  698. or \cmd{menuShell}.
  699. In this case, the resource value is copied and won't be modified if the original
  700. resource is modified.
  701. For instance, in the following example, the button inherits
  702. its \cmd{-fontList} default value from bulletin board \cmd{-buttonFontList},
  703. on the other hand, the button's background color is taken from the
  704. class defaults, not from the BulletinBoard.
  705. Pushing the button will change the BulletinBoard's \cmd{-buttonFontList} 
  706. resource, which will not update the button's font list.
  707. \ttinclude{examples/test_hierarchy.tcl}
  708. %--------------------------
  709. \subsection{X Defaults}
  710. The usual X Defaults mechanism is used to provide defaults to resources.
  711. Default values are looked in files desiganted by the {\tt XAPPDEFAULTS}
  712. environemnent variable, with eventually a locallization directory
  713. (desiganted by the {\tt LANG} variable).
  714. {\tt XAPPDEFAULTS} defaults to {\tt /usr/lib/\linebreak[0]X11/\linebreak[0]app-defaults},
  715. and {\tt LANG} is usually not defined. In this simplest case, the 
  716. looked file is {\tt /usr/lib/X11/app-defaults/\em Application\-Name}, where
  717. {\tt\em ApplicationName} is the class name of your application
  718.     \index{xtappinitialize@\cmd{xtAppInitialize}}
  719. (see {\tt xtAppInitialize}).
  720. \smallskip
  721. This might be overiden by \cmd{xrdb}(1).
  722. Usually, login scripts read a user-customized resource file, often named
  723. \cmd{.XDefaults}, or \cmd{.Xresources} using \cmd{xrdb -merge}.
  724. It is the usual way a user configure its environement.
  725. \smallskip
  726. Last, some application use special configuration files, that might also
  727. contains some resources ({\tt mwm}(1) is a good exemple of this quite 
  728. complex area,
  729. has is looks in not less than eight different resource files...)
  730. \medskip
  731. Those resources files contain line specifying default resource value for 
  732. widget or widget class resources. 
  733. The syntax is~:
  734.     \begin{center}
  735.         \vspace{1mm}
  736.         \sym{resourcePath} \cmd{ : } \sym{value}
  737.         \vspace{1mm}
  738.     \end{center}
  739. \noindent
  740. where \sym{value} is the string representation for the resource, 
  741. and \sym{resourcePath}
  742. a dot-separated path naming a particular resource.
  743. Resource paths start with an optional application name.
  744. Without it, the default apply to all application.
  745. The following names in the path may refer to widget class (when starting 
  746. with an upper case), to widget names (as defined by \moat\ creation command), 
  747. or to application specific scoping.
  748. The \cmd{*} character may be used to match any portion of the resource
  749. path.
  750. This following examples should clarify this~: \\
  751. \begin{tabular}{ll}
  752.     \cmd{*Background}                    & for all widgets, in all sessions. \\
  753.     \cmd{*PushButton.Background}        & for all the push button instances. \\
  754.     \cmd{xterm*Background}                & for all widgets of the {\tt xterm} application.\\
  755.     \cmd{jot.fileMenu.quit.Background}    & for the Quit button in the fileMenu of jot. \\
  756. \end{tabular}
  757. %--------------------------
  758. \subsection{Resource types}
  759. \label{res:types}
  760.     Some resource are just string values (as \cmd{-labelString}), 
  761.     but other one have more complicated types (as colors).
  762.     As \moat\ is a string language, all values should be manipulated in string 
  763.     representations, and \moat\ uses either \Motif\ internal either 
  764.     specific converters to make the necessary conversions.
  765.     This section will briefly describes the main types used 
  766.     by \Tm\ and \moat.
  767. \subsubsection*{Basic types~: Integer, Boolean and String}
  768. \index{integer@\sym{Integer}}
  769. \index{boolean@\sym{Boolean}}
  770. \index{string@\sym{String}}
  771. In \Tcl, evry variable's value is a character string. Nevertheless, some 
  772. string have a meaning as an integer, or as a boolean.
  773. In \Tm, a \sym{String} could be any \Tcl\ string or list, correctrly 
  774. surounded by braces or double-quotes.
  775. An \sym{Integer} is a particular string, with only decima digits in it.
  776. A \sym{Boolean} is either one of the following words
  777. \cmd{true}, \cmd{yes}, \cmd{on}, \cmd{false}, \cmd{no}, \cmd{off}
  778. (in upper/lower/mixed cases), either an integer (0 means \cmd{False}).
  779. \subsubsection*{Dimension}
  780. \index{dimension@\sym{Dimension}}
  781. \sym{Dimension} are particular \sym{Integer} measuring distance in screen 
  782. space.
  783. Their actual value depends on an \cmd{-units} resource, which might 
  784. define something different horizontaly and verticaly (when based on current font 
  785. metrics for instance).
  786. For instance, the following size set a window size to 80x24 characteres~:
  787. \begin{tclmode}
  788.     $window setValues \
  789.         -units 100th_font_units \
  790.         -width 8000 -height 2400
  791. \end{tclmode}
  792. \subsubsection*{Color resources}
  793. \index{pixel@\sym{Pixel}|see \sym{Color}}
  794. \index{color@\sym{Color}}
  795. In \XWinsys, colors may be specified using portable
  796. symbolic names (such as {\tt NavyBlue}) defined in the
  797. \cmd{/usr/lib/X11/rgb.txt} file, 
  798. or RGB hexadecimal triplets of the form \cmd{\#RGB}, 
  799. (with \cmd{R}, \cmd{G} and \cmd{B} being one to four hexa
  800.  digits),
  801. such as \cmd{\#081080} 
  802. (a dark blue, defined with 8 bits by channel).
  803. Depending of your visual type, \XWinsys\ may alway provide you the 
  804. exact color you specified, or give you an hopefully close 
  805. approximation.
  806. RGB values are not portable, because they depend on the screen 
  807. hardware gamma, the software contrast correction, 
  808. and the graphic board linearity.
  809. The \cmd{rgb.txt} file should be tuned for each hardware/software
  810. configuration (by your vendor), which is rarely well done.
  811. %------------------------------
  812. \subsubsection*{Font resources}
  813. \index{font@\sym{Font}}
  814. Font names used by X11R4 are fully qualifying dash-separated 
  815. strings, or aliased nick-names.
  816. The general form of the full name is~:
  817.     \begin{center}
  818.         {\tt -\sym{maker}-\sym{name}-\sym{weight}-\sym{slant}-\sym{width}%
  819.         -\sym{serif}-11-80-100-100-m-60-\sym{encoding}}
  820.     \end{center}
  821. \noindent
  822. With~:
  823. \begin{description}
  824. \item[\sym{maker}:]
  825.     The font maker, such as \cmd{adobe}, \cmd{bitstream}, 
  826.     or \cmd{sgi}.
  827. \item[\sym{name}:]
  828.     The name for this font, as defined by the maker.
  829.     Adobe's fonts includes \cmd{Helve\-tica}, \cmd{Zapf Chancery}, ...
  830. \item[\sym{weight}:]
  831.     One of \cmd{bold}, \cmd{medium}, \cmd{normal}, 
  832.     \cmd{demi}, or \cmd{light}.
  833. \item[\sym{slant}:]
  834.     one of \cmd{o}(blic), \cmd{r}(oman).
  835. \item[\sym{width}:]
  836.     width of the characters, one of \cmd{normal}, \cmd{narrow}, ...
  837. \item[\sym{serif}:]
  838.     nothing, or \cmd{sans}.
  839. \item[sizes]
  840.     font size, in various units.
  841. \item[\sym{encoding}:]
  842.     Usually \cmd{iso8859-1}.
  843. \end{description}
  844. The \cmd{*} character might be used to match any of the font specifier.
  845. On unix machines, the files 
  846. \cmd{/usr/lib/X11/fonts/*/fonts.dir} lists all existing
  847. fonts of the actual X server.
  848. %---------------------------
  849. \subsubsection*{Font list}
  850. \index{font list@Font List}
  851. Font lists are coma separated list of fonts.
  852. The first font in the list is the default one, the other ones are used 
  853. in coupound string.
  854. This is quite useless by now, because there is no consensus on how
  855. to get multi-font {\tt XmString}s, and none of the various proposition
  856. is currently implemented in \Tm.
  857. \medskip
  858. Widget default font list usually derives from one of their ancestor.
  859. Default for top-level shell are set from the \cmd{VendorShell} abstract
  860. class, of from the {\sl X defaults} mechanism.
  861. %---------------------------
  862. \subsubsection*{Pixmap resources}
  863. \index{pixmap@\sym{Pixmap}}
  864. \index{bitmap@\sym{Bitmap}|see pixmap@\sym{Pixmap}}
  865. Pixmaps are small rectangular arrays of pixels, used to be drown
  866. as button, or to be tiled to fill areas.
  867. \medskip
  868. On color display, pixmaps may be either bi-color, using the 
  869. \cmd{-background} and \cmd{-fore\linebreak[0]ground} resources, 
  870. either full color.
  871. Pixmaps may also be partially transparent, when they are
  872. accompanied by a transparency mask.
  873. \medskip
  874. Simple bi-color pixmaps are created from a bitmap, using the current 
  875. foreground and background colors at the time they are first loaded.
  876. Once created, the colored pixmap will be retained in the server's
  877. memory by a caching mechanism.
  878. At least on some X servers, this coloring will then be retained until
  879. the \XWin\ is restarted.
  880. The \cmd{bitmap} unix command may be used to create or modify bitmaps.
  881. See figure~\ref{fig:pixmaps} for an example of pixmap
  882. used to fill a button label.
  883. \figureexample{pixmaps}{Example of Pixmap button.}
  884. \subsubsection*{Enumerated resources}
  885. For some resources, the value is given by a symbolic name,
  886. which may be chosen only from a small set of legal values.
  887. \Tm\ uses the \Motif\ standard name, without the leading
  888. \cmd{XmN} prefix, in a free upper/lower case combination for 
  889. \cmd{setValues}.
  890. \Tm\ will always return lower case string on \cmd{getValues}.
  891. %----------------------------------------------------------------------------
  892. \section{Callbacks}
  893. \titles{Callbacks}
  894. \label{sec:callbacks}
  895. \index{callbacks@Callbacks}
  896. When the user does things to a widget, it may cause the widget to take certain
  897. actions.  For example, when a button is pressed it changes appearance to
  898. look pressed in. Some of these actions can have \Tcl\ code attached to them,
  899. so that the \Tcl\ code is evaluated when the action is performed. The 
  900. \Tcl\ code is said to be attached to a ``callback'' by a widget command.  
  901. For example, a push button has an \cmd{activateCallback} that is called when 
  902. the user presses and releases the left mouse button inside the widget; 
  903. it has an \cmd{armCallback} that is called when the user presses the mouse 
  904. button; it has a \cmd{disarmCallback} that is called when the user releases 
  905. the mouse button inside the widget.
  906. \Tcl\ code is attached to a callback by giving it as the second argument to 
  907. the appropriate widget method. For example,
  908. \begin{tclmode}
  909.     $btn      armCallback {puts "Stop squashing me!!"}
  910.     $btn   disarmCallback {puts "Ah... that's better"}
  911.     $btn activateCallback {puts "Sorry Dave"; exit 0}
  912. \end{tclmode}
  913. The names of the callbacks available for a particular widget are derived
  914. from the resource documentation for \Motif.  Each callback ends
  915. with the string ``\cmd{Callback}" in its name.  Drop the \cmd{XmN} from the Motif
  916. description to gain the widget command.  Callbacks are treated differently
  917. to other resources because the \Xt\ treats them differently -- the
  918. resource is not meant to be handled directly by any ordinary application.
  919. For each \Tm\ class, a short table will list the callbacks names, and 
  920. the action that fire them.
  921. %------------------------
  922. \subsection{Callback substitution}
  923. \index{callback substitution@Callback!substitution}
  924. When \Motif\ execute a callback, in reaction to some event,
  925. it provides it some parameters (such as the current widget)
  926. or additional data revelant to a given class.
  927. \Tm\ follows \Tk\ in providing the powerful mechanism of 
  928. callback substitution.
  929. Before execution, the \Tcl command list is scanned 
  930. to look for \cmd{\%} character. Each time on is found, the word
  931. that follows is extracted, analyzed, and if recognized, it is
  932. substituted with the corresponding data.
  933. For example, \cmd{\%item} in a \cmd{xmList} callback will be replaced by the item 
  934. selected, and \cmd{\%item\_position} will be replaced by its position 
  935. in the list.
  936. An example of use of callback substitution in a list is~:
  937. \begin{tclmode}
  938.     .list singleSelectionCallback {
  939.         print_info %item %item_position
  940.     proc print_info {item position} {
  941.         puts stdout "item was $item, at position $position"
  942. \end{tclmode}
  943. The table below gives the recognized tags. Their meaning will
  944. be detailed in the context of the corresponding callbacks.
  945. \begin{center}\begin{tabular}{llll}
  946.   \cmd{\%click\_count}    & \cmd{\%endPos}          & \cmd{\%newinsert}     &  \cmd{\%selection\_type}\\
  947.   \cmd{\%closure}        & \cmd{\%item\_length}    & \cmd{\%pattern\_length}& \cmd{\%set}           \\
  948.   \cmd{\%currInsert}    & \cmd{\%item\_position}& \cmd{\%pattern\_length}& \cmd{\%startPos}      \\
  949.   \cmd{\%currInsert}      & \cmd{\%item}            & \cmd{\%pattern}       &  \cmd{\%type}          \\
  950.   \cmd{\%dir\_length}     & \cmd{\%length}          & \cmd{\%pattern}       &  \cmd{\%value\_length} \\
  951.   \cmd{\%dir}             & \cmd{\%mask\_length}    & \cmd{\%ptr}           &  \cmd{\%value}         \\
  952.   \cmd{\%doit}            & \cmd{\%mask}            & \cmd{\%reason}        &  \cmd{\%w}             \\
  953.   \cmd{\%dragContext}     & \cmd{\%newInsert}       & \cmd{\%selected\_items}&                         \\
  954. \end{tabular}\end{center}
  955. \idx{\%reason} should be implemented in the version 0.9, which is substitued by the
  956. reason why the callback was called.
  957. The possible values, as defined in {\tt Xm/Xm.h}, with the leading {\tt XmCR\_} stripped,
  958. are listed in the following table~:
  959. \begin{center}\begin{tabular}{lll}
  960.     \idx{activate}                & \idx{apply}                    & \idx{arm}                    \\
  961.     \idx{browse\_select}        & \idx{cancel}                    & \idx{cascading}            \\
  962.     \idx{clipboard\_data\_delete} & \idx{clipboard\_data\_request} & \idx{command\_changed}        \\
  963.     \idx{command\_entered}        & \idx{create}                    & \idx{decrement}            \\
  964.     \idx{default\_action}        & \idx{disarm}                    & \idx{drag}                \\
  965.     \idx{execute}                & \idx{expose}                    & \idx{extended\_select}        \\
  966.     \idx{focus}                    & \idx{gain\_primary}            & \idx{help}                \\
  967.     \idx{increment}                & \idx{input}                    & \idx{lose\_primary}        \\
  968.     \idx{losing\_focus}            & \idx{map}                        & \idx{modifying\_text\_value}\\
  969.     \idx{moving\_insert\_cursor}& \idx{multiple\_select}        & \idx{no\_match}            \\
  970.     \idx{none}                    & \idx{obscured\_traversal}        & \idx{ok}    \\
  971.     \idx{page\_decrement}        & \idx{page\_increment}            & \idx{protocols}    \\
  972.     \idx{resize}                & \idx{single\_select}            & \idx{tear\_off\_activate} \\
  973.     \idx{tear\_off\_deactivate}    & \idx{to\_bottom}                & \idx{to\_top}                \\
  974.     \idx{unmap}                    & \idx{value\_changed}            &        \\
  975. \end{tabular}\end{center}
  976. %------------------------
  977. \subsection{Callback cross references}
  978. \index{callback cross ref@Callback!cross reference}
  979. The following table list all callbacks supported by \Tm\ 
  980. (the full method name to add the callback code is obtained by appending 
  981. \cmd{Callback}~; they are listed in {\tt <Xm/Xm.h>}, with a {\tt XmN} prefix),
  982. and the class in which they are first defined~:
  983. \begin{center}\small\begin{tabular}{ll|ll}
  984.                Name    &  Defined by    &           Name    & Defined by \\
  985. \hline %----------------------------------------------------------
  986. \cmd{activate}            &  Text/Button    &    \cmd{losePrimary}        &    Text            \\
  987. \cmd{apply}                &  SelectionBox    &    \cmd{losingFocus}        &    Text            \\
  988. \cmd{arm}                &      Button    &    \cmd{map}                &   BulletinBoard    \\
  989. \cmd{browseSelection}    &       List        &    \cmd{modifyVerify}        &    Text            \\
  990. \cmd{cancel}            & SelectionBox    &    \cmd{motionVerify}        &    Text            \\
  991. \cmd{cascading}            & CascadeButton    &    \cmd{multipleSelection}    &    List            \\
  992. \cmd{commandChanged}    &    Command        &    \cmd{noMatch}            &    SelectionBox    \\
  993. \cmd{commandEntered}    &    Command        &                               &                    \\
  994. \cmd{decrement}            &    ScrollBar    &    \cmd{ok}                &    SelectionBox    \\
  995. \cmd{defaultAction}        &      List        &    \cmd{pageDecrement}        &    ScrollBar        \\
  996. \cmd{destroy}            &      Core        &    \cmd{pageIncrement}        &    ScrollBar        \\
  997. \cmd{disarm}            &      Button    &    \cmd{popdown}            &    Shell            \\
  998. \cmd{drag}                &      Scale        &    \cmd{popup}                &    Shell            \\
  999. \cmd{entry}                &    RowColumn    &    \cmd{resize}            &    Draw.            \\
  1000. \cmd{expose}            &      Draw.    &    \cmd{simple}            &    ?                \\
  1001. \cmd{extendedSelection}    &       List        &    \cmd{singleSelection}    &    List            \\
  1002. \cmd{focus}                & BulletinBoard    &    \cmd{toBottom}            &    ScrollBar        \\
  1003. \cmd{gainPrimary}        &       Text        &    \cmd{toPosition}        &    (Text)            \\
  1004. \cmd{help}                &   Mgr./Prim.  & \cmd{toTop}                &    ScrollBar        \\
  1005. \cmd{increment}            &    Scrollbar    &    \cmd{unmap}                &   BulletinBoard    \\
  1006. \cmd{input}                &  DrawingArea    &    \cmd{valueChanged}        & Text/Scale/ScrollBar \\
  1007. \end{tabular}\end{center}
  1008. %-----------------------------------------------------------------------
  1009. \section{Actions and Translations}
  1010. \label{sec:actions}
  1011. \label{sec:translations}
  1012. \titles{Actions}
  1013. Actions and translations are \Xt\ concepts that exists in \Tm\ too.
  1014. Each possible user input have a symbolic name, and they are called
  1015. ``events''.
  1016. Each reaction of the interface to some event also have a name, they are
  1017. called the actions.
  1018. \index{navigation@Navigation}
  1019. Widgets may have behaviours, which are table that say what action to fire
  1020. when event arises. They are called the translations tables.
  1021. \Motif\ applications have translation tables that enable to use the 
  1022. keyboard to navigate between widgets, and to select them.
  1023. This gives keyboard equivalent to mouse actions.
  1024. \medskip
  1025. The translation tables are inherited through the class hierarchy.
  1026. The list of all supported events and actions is quite long.
  1027. Look in a \Motif\ book to find about it...
  1028. %-----------------------
  1029. \subsection{Adding Actions and Translations}
  1030. \index{actions@Actions!adding}
  1031. \index{translation@Translations!adding}
  1032. Actions may be added to a widget in a similar way to the C version. 
  1033. In that you define an action in a translation table which is set in the widget. 
  1034. In this binding, the \Tcl\ code is placed as the arguments to the
  1035. action in the translation table. 
  1036. Registering the translation using the \idx{action} \Tm\ action 
  1037. links a generic action handler which in turn will handle the \Tcl\ code. 
  1038. Here is what it looks like to add translation to make an arrow 
  1039. turn left or right when `l' or `r' is pressed:
  1040. \begin{tclmode}
  1041.     xmArrowButton .arrow managed
  1042.     .arrow setValues -translations \
  1043.         {<Key>r: action(arrow_direction %w arrow_right)
  1044.          <Key>l: action(arrow_direction %w arrow_left)}
  1045.     proc arrow_direction {arrow direction} {
  1046.         puts stdout "Changing direction to $direction"
  1047.         $arrow setValues -arrowDirection $direction
  1048. \end{tclmode}
  1049. As with callbacks, they are supported substitutions.
  1050. In the current versions, the only one is \idx{\%w} which is substitued
  1051. with the current widget path
  1052. (Other substitutions just return the {\tt ERROR!!} magic string).
  1053. \subsection{Trigering Actions}
  1054. The method \cmd{callActionProc} is available for every widget.
  1055. The purpose of this is to allow regresion tests to be performed.
  1056. This takes an action as further parameter, using the usual \Xt\ syntax.
  1057. For example, to simulate the return key press occurring within an arrow button,
  1058. call the \cmd{ArmAndActivate()} action:
  1059. \begin{tclmode}
  1060.     .arrow callActionProc ArmAndActivate()
  1061. \end{tclmode}
  1062. This sends (by default) a ClientMessage event to the widget. Most widgets
  1063. ignore the event for most events, so this is sufficient. Some actions
  1064. require event detail, though. For example, when a mouse button release occurs,
  1065. the widget checks to see if the release occurred {\em inside} or {\em outside} the
  1066. widget.
  1067. It does this because if the event occurs inside, then the callbacks
  1068. attached to the \cmd{Activate()} action are invoked, but otherwise they are not.
  1069. To handle this, an event of type ButtonPress, ButtonRelease, KeyPress or
  1070. KeyRelease can be prepared with some fields set. For example, a ButtonRelease
  1071. occurring within the arrow can be sent by.
  1072. \begin{tclmode}
  1073.     .arrow callActionProc Activate() \
  1074.         -type ButtonPress \
  1075.         -x 0 -y 0
  1076. \end{tclmode}
  1077. Some of the Text manipulation actions require a KeyPress event, such as
  1078. \cmd{self-\linebreak[0]insert()}, which inserts the character pressed. The character is
  1079. actually encoded as a keycode, which is a hardware dependant code, too
  1080. low-level for this binding. To prepare such an event, this toolkit uses
  1081. {\em keysyms} which are abstractions for each type of key symbol.
  1082. The alphanumerics have simple representations as themselves
  1083. (`\cmd{a}', `\cmd{A}', `\cmd{2}', etc).
  1084. Others have symbolic names (`\cmd{space}', `\cmd{Tab}', `\cmd{BackSpace}', etc).
  1085. These are derived from the \XWin\ Reference manual or in the file
  1086. \cmd{<X11/keysymdefs.h>} by removing the prefix \cmd{XK\_}.
  1087. For example, to insert the three characters `\cmd{A a}' into \cmd{.text} :
  1088. \begin{tclmode}
  1089.     .text callActionProc self-insert() \
  1090.         -type KeyPress \
  1091.         -keysym A
  1092.     .text callActionProc self-insert() \
  1093.         -type KeyPress \
  1094.         -keysym space
  1095.     .text callActionProc self-insert() \
  1096.         -type KeyPress \
  1097.         -keysym a
  1098. \end{tclmode}
  1099. The set of actions that require this level of preparation of the X event
  1100. is nowhere documented explicitly. You have to read between the lines of
  1101. the Motif documentation, or guess at behaviour (or read Motif source code).
  1102. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1103. %-----------------------------------------------------------------------
  1104. \section{Base classes}
  1105. \label{sec:abstracts}
  1106. All \Tm\ widgets derive from a small set of classes,
  1107. namely \cmd{Core}, \cmd{Primitive}, \cmd{Manager} and \cmd{Shell}.
  1108. You cannot create any widget of those classes,
  1109. because they are abstract base classes.
  1110. They are used to define sets of resources, behaviors
  1111. and methods common to all the derived widget classes which have
  1112. binding in \Tm.
  1113. This section will describe this abstract classes.
  1114. %------------------------------
  1115. \subsection{The Core Class}
  1116. \label{class:Core}
  1117. \titles{\cmd{Core}}
  1118. The Core class is the ancestor of all \Tm\ widget classes.
  1119. Hence methods and resources defined in this section equally 
  1120. apply to all \Tm\ objects.
  1121. The Core class does not implement any behavior (neither action,
  1122. translation nor callback), and do even not suppose that something 
  1123. should be drawn.
  1124. %---------------------------
  1125. \subsubsection{Core Methods}
  1126. The Core class defines the basic set of methods common to 
  1127. all derived classes, described below~:
  1128. \begin{description}
  1129. \indexeditem{realizewidget}{\sym{w} \cmd{realizeWidget}}
  1130.     Create windows for the widget and its children,
  1131.     usually used only on the main widget, as in
  1132.     ``\cmd{.  realizeWidget}.''
  1133. \indexeditem{destroywidget}{\sym{w} \cmd{destroyWidget}}
  1134.     Destroy the widget \sym{w}, all sub-widgets 
  1135.     and the associated \Tcl\ commands.
  1136.     Note that destroying the main window (\cmd{. destroyWidget}) should
  1137.     gracefully exit the main loop, while \cmd{exit 0} should exit
  1138.     the \Tcl\ interpreter.
  1139. \indexeditem{mapwidget}{\sym{w} \cmd{mapWidget}}
  1140.     Map the given widget onto screen, to make it visible. This is
  1141.     autmatically done when the widget is managed (see below).
  1142. \indexeditem{unmapwidget}{\sym{w} \cmd{unmapWidget}}
  1143.     Unmap the widget from its parent's screen, making it invisible,
  1144.     but it stay in geometry management.
  1145. \indexeditem{managechild}{\sym{w} \cmd{manageChild}}
  1146.     Bring the widget (back) under geometry management and make it appear (again).
  1147.     This equivalent to the \cmd{managed} parameter when the widget 
  1148.     is created.
  1149.     Some widget cannot be managed at creation time, for instance
  1150.     when its parent needs special setting in order to handle
  1151.     it properly.
  1152.     Another example is menus and dialogs~: you might want to create 
  1153.     them at the application initialisation, but it is not a good idea 
  1154.     to display them permanently.
  1155. \indexeditem{unmanagechild}{\sym{w} \cmd{unmanageChild}}
  1156.     Un-managing a widget un-map it from screen, making it invisible,
  1157.     and removes it from geometry management of the parent.
  1158. \indexeditem{setsensitive}{\sym{w} \cmd{setSensitive} \sym{Boolean}}
  1159.     An insensitive widget do not respond to user input.
  1160.     When such a widget is disabled (\sym{w} \cmd{setSensitive false}), 
  1161.     it is usually drawn dimmed (using a pattern).
  1162.     The main use is to disable buttons or menu items that are not allowed
  1163.     in the current state of the application.
  1164. \indexeditem{setvalues}{\sym{w} \cmd{setValues} \sym{rsrc} \sym{value} ...}
  1165.     This command is used to change resource values for an
  1166.     already existing widget. The required parameters are a list
  1167.     of pairs of resource name and string value. The following
  1168.     change the text colors of widget \cmd{.frm.text}~:
  1169. \begin{tclmode}
  1170.     .frm.text setValues \
  1171.         -background lightGray \
  1172.         -foreground #111
  1173. \end{tclmode}
  1174.     \noindent
  1175.     Each widget class define which resource may be set, their types
  1176.     and accepted values.
  1177.     Resource will be described in general in section~\ref{sec:resources},
  1178.     and with each widget description.
  1179. \indexeditem{getvalues}{\sym{w} \cmd{getValues} \sym{rsrc} \sym{variable} ...}
  1180.     This is the dual command~: given a parameter list of pairs of
  1181.     \Tm\ resource names and \Tcl\ names, it set each variable to the current
  1182.     value of the corresponding resource.
  1183.     \Motif\ reverse conversions are used for this purpose, and \Tm\ 
  1184.     does not actually provide all of them.
  1185.     This means that you should be able to setup all resource types, 
  1186.     but may not be able to retrieve all of them.
  1187. \begin{tclmode}
  1188.     proc flash {widget {fg black} {bg red}} {
  1189.          $widget getValues \
  1190.             -background old_bg  -foreground old_fg
  1191.          $widget setValues \
  1192.             -background $bg     -foreground $fg
  1193.          wait 0.1
  1194.          $widget setValues \
  1195.             -background $old_bg -foreground $old_fg
  1196. \end{tclmode}
  1197. \index{resources}{\sym{w} \sym{resources}}
  1198.     Returns the list of all the active resources of the given widget.
  1199.     For each resource, a quadruple
  1200.     \begin{center}
  1201.         \cmd{\{\sym{name} \sym{Class} \sym{type} \sym{value}\}}
  1202.     \end{center}
  1203.     is returned.
  1204. \index{callback}{\sym{w} \sym{any}\cmd{Callback} \sym{tclProc}}
  1205.     If the widget method name contain the substring "Callback",
  1206.     then \Tm\ ask \Motif\ to register the command list given in argument.
  1207.     When th especified event occures, it will be interpreted (in the global context).
  1208.     Section~\ref{sec:callbacks} will discusses callbacks in general.    
  1209. \index{parent}{\sym{w} \cmd{parent}}
  1210.     The \cmd{parent} widget command is used to get the
  1211.     parent widget name~: if a regular widget \cmd{.a.b.c} have been created,
  1212.     then \cmd{set x [.a.b.c parent]} should set the string
  1213.     \cmd{".a.b"} to the variable \cmd{x}.
  1214.     The exact result is not always obvious, because some widgets use hiden 
  1215.     parents, as in dialogs.
  1216. \index{processtraversal}{\sym{w} \cmd{processTraversal} \sym{direction}}
  1217.     Change the widget that receive the keyboard input focus.
  1218.     \sym{direction} may be one of~:
  1219.     \defx{\sym{w} \cmd{processTraversal} \sym{direction}}
  1220.     \begin{description}
  1221.         \item[\idy{current}]
  1222.         \item[\idy{home}]
  1223.         \item[\idy{up}]
  1224.         \item[\idy{down}]
  1225.         \item[\idy{left}]
  1226.         \item[\idy{right}]
  1227.         \item[\idy{next}]
  1228.         \item[\idy{next\_tab\_group}]
  1229.         \item[\idy{previous\_tab\_group}]
  1230.     \end{description}
  1231. % This will be indexed in the drap&drop section !
  1232. \item[\sym{w} \cmd{dragStart} \sym{rsrc} \sym{value} ...]
  1233. \item[\sym{w} \cmd{dropSiteRegister} \sym{rsrc} \sym{value} ...] \dopar
  1234.     See the {\sl Drad and Drop} section (page~\pageref{sec:dragdrop}) for details 
  1235.     about this mehods.
  1236. % This will be indexed in the Xt drawing section.
  1237. \item[\sym{w} \cmd{getGC} \sym{rsrc} \sym{value} ...] \dopar
  1238.     This method is used to retrieve the \Xlib\ graphical context of a widget.
  1239.     There must be at leat one resource defined.
  1240.     The allowed resources are \cmd{-background} and \cmd{-foreground}.
  1241.     See section on drawn widget (page~\pageref{sec:drawn}) for information
  1242.     about user defined graphics in \Tm\ widgets.
  1243. \indexeditem{callactionproc}{\sym{w} \cmd{callActionProc}}
  1244.     Call an action procedure, usually used to test \moat, or your own code.
  1245. \end{description}
  1246. %-----------------------------
  1247. \subsubsection{Core resources}
  1248. \label{class:core}
  1249. \index{core class@\cmd{Core}}
  1250. \begin{rsrctable}{Core}
  1251.   \idx{-accelerators}        &  \sym{none}    &    \sym{String}    \\
  1252.   \idx{-background}            & \sym{dynamic}    &    \sym{Color}        \\
  1253.   \idx{-backgroundPixmap}    &  \sym{none}    &    \sym{Pixmap}    \\
  1254.   \idx{-borderColor}        & \sym{dynamic}    &     \sym{Color}        \\
  1255.   \idx{-borderWidth}        &    \cmd{1}    &     \sym{Integer}    \\
  1256.   \idx{-heigth}                & \sym{dynamic}    &     \sym{Integer}    \\
  1257.   \idx{-mappedWhenManaged}    &  \cmd{True}    &    \sym{Boolean}    \\
  1258.   \idx{-sensitive}            &  \cmd{True}    &    \sym{Boolean}    \\
  1259.   \idx{-translations}        &  \sym{none}    &    \sym{String}    \\
  1260.   \idx{-width}                & \sym{dynamic}    &    \sym{Integer}    \\
  1261.   \idx{-x}                    &    \cmd{0}    &    \sym{Integer}    \\
  1262.   \idx{-y}                    &    \cmd{0}    &    \sym{Integer}    \\
  1263. \end{rsrctable}
  1264. The table describes resource common to all widgets.
  1265. A \cmd{Core} widget (i.e. any widget) basically is some empty
  1266. rectangle, with an optional border.
  1267. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1268. %------------------------------
  1269. \subsection{The Primitive class}
  1270. \label{class:primitive}
  1271. \titles{\cmd{Primitive}}
  1272. \index{primitive@\cmd{Primitive}}
  1273. The \cmd{Primitive} class derives from the \cmd{Core} class.
  1274. This abstract class is designed to define resouces and behaviour
  1275. common to any widget that may have something 
  1276. drawn on it.
  1277. As the user sees something, \cmd{Primitive} is able to define
  1278. some very general behaviour, which appear as translations, actions
  1279. and callbacks.
  1280. %---------------------------------
  1281. \subsubsection{Primitive resources}
  1282. The table below describes the resources revelant for all 
  1283. widget deriving from \cmd{Primitive}.
  1284. \begin{rsrctable}{Primitive}
  1285.   \idx{-bottomShadowColor}        & \sym{dynamic}    & \sym{Color} \\
  1286.   \idx{-bottomShadowPixmap}        & \sym{none}    & \sym{Pixmap} \\
  1287.   \idx{-foreground}                & \sym{dynamic}    & \sym{Color} \\
  1288.   \idx{-highlightColor}         &  \sym{none}    & \sym{Color} \\
  1289.   \idx{-highlightOnEnter}        &  \cmd{False}    & \sym{Boolean} \\
  1290.   \idx{-highlightThickness}        &   \cmd{2}        & \sym{Integer} \\
  1291.   \idx{-navigationType}            &  \cmd{none}    & \idy{none} \\
  1292.                                   &                & \idy{tab\_group} \\
  1293.                                   &                & \idy{sticky\_tab\_group} \\
  1294.                                   &                & \idy{exclusive\_tab\_group} \\
  1295.   \idx{-shadowThickness}        &   \cmd{2}        & \sym{Integer} \\
  1296.   \idx{-topShadowColor}            & \sym{dynamic}    & \sym{Color} \\
  1297.   \idx{-topShadowPixmap}        &  \sym{none}    & \sym{Pixmap} \\
  1298.   \idx{-traversalOn}            &  \cmd{True}    & \sym{Boolean} \\
  1299.   \idx{-unitType}                &  \cmd{pixels}    & \idy{pixels} \\
  1300.                                   &                & \idy{100th\_millimeters} \\
  1301.                                   &                & \idy{1000th\_inches} \\
  1302.                                   &                & \idy{100th\_points} \\
  1303.                                   &                & \idy{100th\_font\_units} \\
  1304. \end{rsrctable}
  1305. Simple bi-color drawing are done using Primitive's foreground color,
  1306. over the Core's background. Other colors default to mixing of this
  1307. two ones, at the time the widget is created.
  1308. Primitive objects might be highlighted when they are ``entered''
  1309. (get the input focus), by drawing a border around them,
  1310. of a given color.
  1311. They can also be enclosed by a beweled shadow frame, to make
  1312. them appear standing in or out (so called ``3D shapes'').
  1313. Using the \cmd{-unitType} resource, one might choose between screen 
  1314. dependend units (the default), font related units, or device indepedant 
  1315. units. This will affect any subsequent dimensions resources for that widget only. 
  1316. \cmd{-navigationType} refer to the way
  1317. keyboard may be used to navigate between widgets, without using
  1318. the mouse. This is used by managers to quickly navigating between input 
  1319. fields, for instance using the \cmd{<Tab>} key.
  1320. \subsubsection{Primitive callbacks}
  1321.     \begin{center}\begin{tabular}{|l|l|}
  1322.     \hline %------------------------------------------------------------------
  1323.             Method name    & Why \\
  1324.     \hline %------------------------------------------------------------------
  1325.     % Manager/Primitive
  1326.            \idx{helpCallback}    & The help key is pressed. \\
  1327.     % Primitive
  1328.         \idx{destroyCallback}    & Widget is destroyed. \\
  1329.     \end{tabular}\end{center}
  1330. The table above give the only two callbacks defined for evry
  1331. drawable widgets, for which the only supported substitution
  1332. is \cmd{\%w} that expand to the widget path.
  1333. \cmd{destroyCallback} may be used to automaticaly call some cleanup
  1334. procedure when a widget is deleted.
  1335. When the \cmd{Help()} action arised (either through the \cmd{KHelp}
  1336. key, either by a virtual binding), \Motif\ looks for a callback to
  1337. execute in the current widget. If none is found, it look in the 
  1338. parent, the parent's parent, and so one up to the main window.
  1339. Hence, the \cmd{helpCallback} may be used to implement a 
  1340. general or a context sensitive help facility.
  1341. %-----------------------------------------
  1342. \subsubsection{Primitive actions}
  1343. As for any widgets, there is action that match each callback.
  1344. This actions trigger the callbacks execution and the standard widget responses, 
  1345. if any.
  1346. For the \cmd{Primitive} class, they are~:
  1347. \begin{description}
  1348. \indexeditem{help()}{\cmd{Help()}}
  1349.     If there is no callback defined for this widget, this action will propagate
  1350.     the help action to the widget's parent. If no callback are defined upto 
  1351.     the root widget, the action will simply be forgeted.
  1352. \indexeditem{destroy()}{\cmd{Destroy()}}
  1353.     The callbacks will be called before destroying a widget, to enable 
  1354.     application specific cleanup to take place automatically when a widget is 
  1355.     destroyed.
  1356. \end{description}
  1357. \subsubsection{Primitive translations}
  1358. The only translation defined for the \cmd{Primitive} class is~:
  1359. \begin{center}
  1360.     \cmd{<KHelp>: Help()}
  1361. \end{center}
  1362. which means that the symbolic key \cmd{KHelp} will trigger the 
  1363. \cmd{Help()} action. This key is defined in a \cmd{keysym} file used by
  1364. the \XWin\ server.
  1365. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1366. \subsection{Shell classes}
  1367. \label{class:Shell}
  1368. \titles{\cmd{Shell}}
  1369. The \Tm\ Shell classes are used to define resources and behaviours 
  1370. that are common to evry widgets that use theyre own window, such
  1371. as top level windows, popup menues, and dialogs.
  1372. \Motif\ describe several different base class for this purpose,
  1373. some inhetited from \Xt, some defined inside \Motif~:
  1374. \begin{description}
  1375. \indexeditem{shell}{\cmd{Shell}}
  1376.     The basic shell, ancestor of all other abstract shell classes.
  1377. \indexeditem{toplevelshell}{\cmd{TopLevelShell}}
  1378.     Top level windows are responsibles of iconization.
  1379. \indexeditem{transientshell}{\cmd{TransientShell}}
  1380.     Transient windows are temporary windows, that should not stay visible on
  1381.     screen, and should be iconized along with the top level they are transient
  1382.     for.
  1383. \indexeditem{vendorshell}{\cmd{VendorShell}}
  1384.     Vendor shell resources are setup in the {\sl X\/} serveur, and contain 
  1385.     meaningfull defaults for a particular implementation.
  1386. \indexeditem{wmshell}{\cmd{WMShell}}
  1387.     Handle protocols to assure communications between the application and the 
  1388.     window manager.
  1389. \end{description}
  1390. The tables below display the resources avalaible for all those
  1391. shells.
  1392. \begin{rsrctable}{ApplicationShell}
  1393.     \idx{-argc}                    & Set by \cmd{XtInitialize()}
  1394.                                                 & \sym{Integer}        \\
  1395.     \idx{-argv}                    & Set by \cmd{XtInitialize()}
  1396.                                                 & \sym{String Array}\\
  1397. \end{rsrctable}
  1398. \begin{rsrctable}{TopLevelShell}
  1399.     \idx{-iconic}                &    \cmd{False}    &    \sym{Boolean}    \\
  1400.     \idx{-iconName}                &    \cmd{""}    &    \sym{String}    \\
  1401.     \idx{-iconNameEncoding}        &\cmd{xa\_string}&    \idy{compound\_text}    \\
  1402.                                 &                &    \idy{xa\_string}    \\
  1403. \end{rsrctable}
  1404. \begin{rsrctable}{TransientShell}
  1405.       \idx{-transientFor}            &    \sym{none}    &    \sym{Widget}    \\
  1406. \end{rsrctable}
  1407. \begin{rsrctable}{VendorShell}
  1408.     \idx{-defaultFontList}        & \sym{dynamic}    & \sym{font list}    \\
  1409.     \idx{-deleteResponse}        & \cmd{destroy}    & \idy{do\_nothing}    \\
  1410.                                 &                & \idy{unmap}        \\
  1411.                                 &                & \idy{destroy}    \\
  1412.     \idx{-keyboardFocusPolicy}    & \cmd{explicit}& \idy{explicit}    \\
  1413.                                 &                & \idy{pointer}    \\
  1414.     \idx{-mwmDecorations}        &    \cmd{-1}    & \sym{Integer}        \\
  1415.     \idx{-mwmFunctions}            &    \cmd{-1}    & \sym{Integer}    \\
  1416.     \idx{-mwmInputMode}            &    \cmd{-1}    & \sym{Integer}    \\
  1417.     \idx{-mwmMenu}                &    \cmd{""}    & \sym{String}    \\
  1418.     \idx{-shellUnitType}        &  \cmd{pixels}    & \idy{pixels} \\
  1419.                                 &                & \idy{100th\_milimeters} \\
  1420.                                 &                & \idy{1000th\_inches} \\
  1421.                                 &                & \idy{100th\_points} \\
  1422.                                 &                & \idy{100th\_font\_units} \\
  1423.     \idx{-useAsyncGeometry}        &    \cmd{False}    & \sym{Boolean}    \\
  1424. \end{rsrctable}
  1425. \begin{rsrctable}{WMShell}
  1426.     \idx{-baseHeight}            &  \sym{none}    & \sym{Integer}    \\
  1427.     \idx{-baseWidth}            &  \sym{none}    & \sym{Integer}    \\
  1428.     \idx{-heightInc}            &  \sym{none}    & \sym{Integer}    \\
  1429.     \idx{-iconMask}                &  \sym{none}    & \sym{Pixmap}    \\
  1430.     \idx{-iconPixmap}            &  \sym{none}    & \sym{Pixmap}    \\
  1431.     \idx{-iconWindow}            &  \sym{none}    & \sym{Window}    \\
  1432.     \idx{-iconX}                &    \cmd{-1}    & \sym{Integer}    \\
  1433.     \idx{-iconY}                &    \cmd{-1}    & \sym{Integer}    \\
  1434.     \idx{-initialState}            & \cmd{normalState}
  1435.                                                 & \idy{iconicState} \\
  1436.                                 &                & \idy{normalState} \\
  1437.     \idx{-input}                &    \cmd{False} & \sym{Boolean}    \\
  1438.     \idx{-maxAspectX}            &    \sym{none}    & \sym{Integer}    \\
  1439.     \idx{-maxAspectY}            &    \sym{none}    & \sym{Integer}    \\
  1440.     \idx{-maxHeight}            &    \sym{none}  & \sym{Integer}    \\
  1441.     \idx{-maxWidth}                &    \sym{none}  & \sym{Integer}    \\
  1442.     \idx{-minAspectX}            &    \sym{none}    & \sym{Integer}    \\
  1443.     \idx{-minAspectY}            &    \sym{none}    & \sym{Integer}    \\
  1444.     \idx{-minHeight}            &    \sym{none}  & \sym{Integer}    \\
  1445.     \idx{-minWidth}                &    \sym{none}  & \sym{Integer}    \\
  1446.     \idx{-title}                & \cmd{argv[0]}    & \sym{String}    \\
  1447.     \idx{-titleEncoding}        &\cmd{xa\_string}&    \idy{compound\_text}    \\
  1448.                                 &                &    \idy{xa\_string}    \\
  1449.     \idx{-transient}            &    \cmd{False} & \sym{Boolean}   \\
  1450.     \idx{-waitForWm}            &    \cmd{True}    & \sym{Boolean}   \\
  1451.     \idx{-widthInc}                &    \sym{none}  & \sym{Integer}   \\
  1452.     \idx{-windowGroup}            &                & \sym{Window}    \\
  1453.     \idx{-winGravity}            & \sym{dynamic} & \sym{Integer}   \\
  1454.     \idx{-wmTimeout}            & \cmd{5000}ms    & \sym{Integer}      \\
  1455. \end{rsrctable}
  1456. \begin{rsrctable}{Shell}
  1457.     \idx{-allowShellResize}        &   \cmd{False} & \sym{Boolean}   \\
  1458.     \idx{-geometry}                &    \cmd{""}    & \sym{String}    \\
  1459.     \idx{-overrideRedirect}        &   \cmd{False} & \sym{Boolean}   \\
  1460.     \idx{-saveUnder}            &   \cmd{False} & \sym{Boolean}   \\
  1461.     \idx{-visual}                &   Inherited    & \sym{String}    \\    
  1462. \end{rsrctable}
  1463. \paragraph{Window resizing constraints}
  1464. \index{resizing@Resizing}
  1465. \index{window resizing@Window resizing}
  1466. \index{constraints@Constraints}
  1467. may be set on its dimensions of the window, or on 
  1468. its aspect (ratio between width and height).
  1469. Beside minimal and maximal dimensions, window dimension may be 
  1470. constrained to follow a given increment. For instance, using the following
  1471. setting, the only width allowed for interactive resizing will be 150 and 
  1472. 250~:
  1473. \begin{tclmode}
  1474.     -minWidth 100 -baseWidth 50 -widthInc 100 -maxWidth 300
  1475. \end{tclmode}
  1476. \index{aspect@Aspect}
  1477. Window aspects are set using a numerator/denominator formula~:
  1478. \begin{equation}
  1479. \frac{\cmd{minAspectX}}{\cmd{minAspectY}} 
  1480.     \leq    \frac{\mbox{width}}{\mbox{height}}
  1481.     \leq    \frac{\cmd{minAspectX}}{\cmd{minAspectY}}
  1482.     \nonumber
  1483. \end{equation}
  1484. Hence, the following setting constrains the width to stay between a third and 
  1485. twice the height~:
  1486. \begin{tclmode}
  1487.     -minAspectX 1 -manAspectY 3 -maxAspectX 2 -minAspectY 1
  1488. \end{tclmode}
  1489. \medskip
  1490. Interactive window resizing may also be ignored by setting the 
  1491. \cmd{-allowShellResize} resource to \cmd{False}.
  1492. \paragraph{Window icon resouces}
  1493. \index{icon@Icon}
  1494. may be used to define the window icon type, its placement, ...
  1495. Icons may be drawn using a (possibly partially transparent) pixmap, or
  1496. by using a specific alternate window (\cmd{-iconWindow}). A window may be 
  1497. setup to appear in iconic state at creation (\cmd{-initialState iconicState}), 
  1498. and its current state may be retrieved or changed using the \cmd{-iconic} 
  1499. resource.
  1500. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1501. %----------------------------------------------------------------
  1502. \section{Basic widgets}
  1503. \label{sec:basic}
  1504. This section will detail the basic \Motif\ widgets, from which all the 
  1505. more sofisticated one derives.
  1506. %------------------------
  1507. \subsection{\cmd{xmLabel}}
  1508. \index{xmlabel@\cmd{xmLabel}}
  1509. \index{label@Label|see\cmd{xmLabel}}
  1510. \titles{\cmd{xmLabel}}
  1511. A label widget is just a small written piece of text.
  1512. For instance, executing the following \moat\ script
  1513.     \ttinclude{examples/hello.tcl}
  1514. \noindent
  1515. would display the following window on your screen~:
  1516.     \window{hello}
  1517. Note that the text will be broken into seperate lines only if
  1518. you put newlines in it.
  1519. It may contains non-ascii characteres (using the encoding defined in the 
  1520. font, usually \cmd{ISO8859-1}).
  1521. See figure~\ref{fig:bigLabel} for a more complexe example.
  1522.     \figureexample{bigLabel}{A more complex label example.}
  1523. %-------------------------
  1524. \subsubsection*{Resources}
  1525. \begin{rsrctable}{xmLabel}
  1526.     \idx{-accelerator}                &    \cmd{""}    &    \sym{String} \\
  1527.     \idx{-acceleratorText}            &    \cmd{""}    &    \sym{String} \\
  1528.     \idx{-alignment}                & center        &    \idy{alignment\_center} \\
  1529.                                     &                &    \idy{alignment\_beginning} \\
  1530.                                     &                &    \idy{alignment\_end} \\
  1531.     \idx{-fontList}                    & inherited        &    \sym{fontList} \\
  1532.     \idx{-labelInsensitivePixmap}    & \sym{none}    &    \sym{Pixmap} \\
  1533.     \idx{-labelPixmap}                & \sym{none}    &    \sym{Pixmap} \\
  1534.     \idx{-labelString}                &  widget name    &    \sym{String} \\
  1535.     \idx{-labelType}                & \cmd{string}  &    \idy{string} \\
  1536.                                       &               &    \idy{pixmap} \\
  1537.     \idx{-marginBottom}                &    \cmd{0}     &    \sym{Integer} \\
  1538.     \idx{-marginHeight}                &    \cmd{0}     &    \sym{Integer} \\
  1539.     \idx{-marginLeft}                &   \cmd{0}     &    \sym{Integer} \\
  1540.     \idx{-marginRight}                &   \cmd{0}     &    \sym{Integer} \\
  1541.     \idx{-marginTop}                &     \cmd{0}        &    \sym{Integer} \\
  1542.     \idx{-marginWidth}                &     \cmd{0}        &    \sym{Integer} \\
  1543.     \idx{-mnemonic}                    &    \cmd{""}    &    \sym{String} \\
  1544.     \idx{-mnemonicCharSet}            &    dynamic        &    \sym{String} \\
  1545.     \idx{-recomputeSize}            &  \cmd{True}    &    \sym{Boolean} \\
  1546.     \idx{-stringDirection}            & l\_to\_r        &    \idy{string\_direction\_l\_to\_r} \\
  1547.                                     &                &    \idy{string\_direction\_r\_to\_l} \\
  1548. \end{rsrctable}
  1549. The label may display the \cmd{-labelString} or
  1550. \cmd{-labelPixmap} resource, depending of the \cmd{-labelType} value.
  1551. Labels are always top/bottom centered (inside their margins), but
  1552. may be left or right flushed or centered, depending on \cmd{-alignment}.
  1553. When a label is insensitive, the displayed text is grayed using a 50\% 
  1554. pattern. Pixmap type labels may also be defined to display a different 
  1555. pixmap using \cmd{-label\-Insensitive\-Pixmap}.
  1556. When the displayed material changes, the label may or may not recompute 
  1557. its size, depending of \cmd{-recomputeSize}.
  1558. Some resources are only used in derived class.
  1559. \medskip
  1560. The following resources are inherited from the 
  1561. Primitive (page~\pageref{rsrc:Primitive}),
  1562. and Core classes (page~\pageref{rsrc:Core})~:
  1563. \begin{center}\begin{tabular}{lc|lc}
  1564.     \cmd{-accelerators}            & (Core)    &
  1565.     \cmd{-backgroundPixmap}        & (Core)    \\
  1566.     \cmd{-background}            & (Core)    &
  1567.     \cmd{-borderColor}            & (Core)    \\
  1568.     \cmd{-borderWidth}            & (Core)    &
  1569.     \cmd{-bottomShadowColor}    & (Primitive)    \\
  1570.     \cmd{-bottomShadowPixmap}    & (Primitive)    &
  1571.     \cmd{-foreground}            & (Primitive)    \\
  1572.     \cmd{-heigth}                & (Core)    &
  1573.     \cmd{-highlightColor}        & (Primitive)    \\
  1574.     \cmd{-highlightOnEnter}        & (Primitive)    &
  1575.     \cmd{-highlightPixmap}        & (Primitive)    \\
  1576.     \cmd{-highlightThickness}    & (Primitive)    &
  1577.     \cmd{-mappedWhenManaged}    & (Core)    \\
  1578.     \cmd{-navigationType}        & (Primitive)    &
  1579.     \cmd{-sensitive}            & (Core)    \\
  1580.     \cmd{-shadowThickness}        & (Primitive)    &
  1581.     \cmd{-topShadowColor}        & (Primitive)    \\
  1582.     \cmd{-topShadowPixmap}        & (Primitive)    &
  1583.     \cmd{-translations}            & (Core)    \\
  1584.     \cmd{-traversalOn}            & (Primitive)    &
  1585.     \cmd{-unitType}                & (Primitive)    \\
  1586.     \cmd{-width}                & (Core)    &
  1587.     \cmd{-x}                    & (Core)    \\
  1588.     \cmd{-y}                    & (Core)    &
  1589.                                 &        \\
  1590. \end{tabular}\end{center}
  1591. %-------------------------
  1592. \subsubsection*{Callbacks}
  1593. Label do not define specific callbacks, but just inherit them from
  1594. the Primitive class, namely \cmd{helpCallback} 
  1595. and \cmd{destroyCallback}.
  1596. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1597. \subsection{\cmd{xmText}, \cmd{xmScrolledText} and \cmd{xmTextField}}
  1598. \titles{\cmd{xmText}, \cmd{xmTextField}}
  1599. \index{xmtext@\cmd{xmText}}
  1600. \index{xmscrolledtext@\cmd{xmScrolledText} |see \cmd{xmText}}
  1601. \index{xmtextfield@\cmd{xmTextField}}
  1602. \index{text@Text|see \cmd{xmText}}
  1603. Text widgets display a text string, but also allow the user to edit it. 
  1604. A \cmd{xmTextField} widget display a single-line editable text,
  1605. while a \cmd{xmText} widget usually span multiple lines.
  1606. A \cmd{xmScrolledText} would automatically 
  1607. displays scroll bars if it is larger than the alloted space on screen. 
  1608. Those \cmd{xmScrollBar}s enable the user to change the currently viewed 
  1609. part of the text.
  1610. Selection of parts of text are done by keyboard or mouse 
  1611. interactions, as described below in the translations.
  1612. \medskip
  1613. A scrolled text widget \sym{w} is a composite widget that have the 
  1614. following childrens~:
  1615. \begin{center}\begin{tabular}{lll}
  1616.     \sym{w}\cmd{.HorScrollBar} & \sym{w}\cmd{.VertScrollBar} & \sym{w}\cmd{.ClipWindow}    \\
  1617. \end{tabular}\end{center}
  1618. The associated \Tcl proc might be used to directly access them, as in the 
  1619. following example~:
  1620. \begin{tclmode}
  1621.     xmScrolledText .txt managed
  1622.     set rsrc_list [.txt.ClipWindow resources]
  1623. \end{tclmode}
  1624. \subsubsection*{Methods}
  1625. In addition to the standard \cmd{Core} methods, texts widgets defined
  1626. the following new ones to deal with selection and clipboard~:
  1627. \begin{description}
  1628.     \indexeditem{setstring}{\sym{txt} \cmd{setString} \sym{the\_text}}
  1629.         Change the current text to \sym{the\_text}.
  1630.     \indexeditem{getstring}{\sym{txt} \cmd{getString}}
  1631.         return the whole text as result.
  1632.     \indexeditem{getsubstring}{\sym{txt} \cmd{getSubString} \sym{start} \sym{len} \sym{var}}
  1633.         Set the \Tcl variable \sym{var} to the substring starting at position
  1634.         \sym{start} for \sym{len} characteres. If \sym{len} if larger than
  1635.         some internal threshold, only the first part of the text will be set to \sym{var}.
  1636.         \defx{\sym{txt} \cmd{getSubString} \sym{start} \sym{len} \sym{var}}
  1637.         This method returns either \idy{succeded}, \idy{truncated} or \idy{failed}.
  1638.     \indexeditem{insert}{\sym{txt} \cmd{insert} \sym{position} \sym{string}}
  1639.         Insert \sym{string} in the text, starting at position \sym{position}.
  1640.         Use zero to insert at the beginning of the text.
  1641.     \indexeditem{replace}{\sym{txt} \cmd{replace} \sym{start} \sym{stop} \sym{string}}
  1642.         Replace the portion of text between \sym{start} and \sym{stop} by
  1643.         the new value \sym{string}.
  1644.     \indexeditem{setselection}{\sym{txt} \cmd{setSelection} \sym{start} \sym{stop}}
  1645.         Set the current selection to the substring starting at \sym{start},
  1646.         end ending at \sym{stop}.
  1647.     \indexeditem{getselection}{\sym{txt} \cmd{getSelection}}
  1648.         Returns the primary selection of the text. If nothing
  1649.         is selected, just returns nothing.
  1650.     \indexeditem{getselectionposition}{\sym{txt} \cmd{getSelectionPosition} \sym{start} \sym{stop}}
  1651.         If there is something selected, set the \Tcl variables
  1652.         \sym{start} and \sym{stop} accordingly and returns
  1653.         \cmd{true}, else returns \cmd{false}.
  1654.     \indexeditem{clearselection}{\sym{txt} \cmd{clearSelection}}
  1655.         deselect the current selection.
  1656.     \indexeditem{remove}{\sym{txt} \cmd{remove}}
  1657.         remove the currently selected part of the text.
  1658.     \indexeditem{copy}{\sym{txt} \cmd{copy}}
  1659.         copy the current selection into the clipboard.
  1660.     \indexeditem{cut}{\sym{txt} \cmd{cut}}
  1661.         copy the current selection into the clipboard, then remove
  1662.         it from the text.
  1663.     \indexeditem{paste}{\sym{txt} \cmd{paste}}
  1664.         replace the current selection by the clipboard contains.
  1665.     \indexeditem{setaddmode}{\sym{txt} \cmd{setAddMode} \sym{bool}}
  1666.         Set weither or not the text is in ``add mode''.
  1667.         When in add mode, text insertion won't modify the
  1668.         current selection.
  1669.     \indexeditem{sethighlight}{\sym{txt} \cmd{setHighlight} \sym{start} \sym{stop} \sym{mode}}
  1670.         Change the highlight appearance of the text between
  1671.         \sym{start} and \sym{stop}, but not the current
  1672.         selection.
  1673.         \defx{\sym{txt} \cmd{setHighlight} \sym{start} \sym{stop} \sym{mode}}
  1674.         \sym{mode} may be either \idy{normal}, \idy{selected}
  1675.         or \idy{secondary\_selected}.
  1676.     \indexeditem{findstring}{\sym{txt} \cmd{findString} \sym{start} \sym{stop} \sym{string} \sym{dir} \sym{pos}}
  1677.         Search the current text for \sym{string} between the position
  1678.         \sym{start} and \sym{stop}. 
  1679.         \defx{\sym{txt} \cmd{findString} \sym{start} \sym{stop} \sym{string}}
  1680.         The direction \sym{dir} might be either \idy{forward}, either \idy{backward}.
  1681.         If found, the position of the first occurence is set to the \Tcl variable
  1682.         \sym{pos}, and it returns \cmd{true}, else it returns \cmd{false}.
  1683.     \indexeditem{getinsertposition}{\sym{txt} \cmd{getInsertPosition}}
  1684.         Returns the position of the insert cursor. Zero is the
  1685.         first charactere in the text.
  1686.     \indexeditem{setinsertposition}{\sym{txt} \cmd{setInsertPosition} \sym{position}}
  1687.         Set the cursor insertion point.
  1688.     \indexeditem{getlastposition}{\sym{txt} \cmd{getLastPosition}}
  1689.         Returns the position of the last caractere in the text
  1690.         buffer, in other words, its length.
  1691.     \indexeditem{scroll}{\sym{txt} \cmd{scroll} \sym{lines}}
  1692.         Scroll the text widget by \sym{lines} lines. A positive value
  1693.         scroll it upward, a negative value backward.
  1694.     \indexeditem{showposition}{\sym{txt} \cmd{showPosition} \sym{position}}
  1695.         Scroll the text such that \sym{position} become visible.
  1696.     \indexeditem{gettopcharactere}{\sym{txt} \cmd{getTopCharacter}}
  1697.         Returns the position of the first visible charactere of
  1698.         the text in the widget.
  1699.     \indexeditem{settopcharactere}{\sym{txt} \cmd{setTopCharacter} \sym{position}}
  1700.         Scroll the text so that \sym{position} will be the first
  1701.         visible charactere in the widget.
  1702.     \indexeditem{disableredisplay}{\sym{txt} \cmd{disableRedisplay}}
  1703.         The text will not being redisplayed.
  1704.     \indexeditem{enableredisplay}{\sym{txt} \cmd{enableRedisplay}}
  1705.         The text will redisplay automatically when it changes.
  1706.     \indexeditem{geteditable}{\sym{txt} \cmd{getEditable}}
  1707.         Returns \cmd{true} if the text is editable (that is,
  1708.         the user can edit it), \cmd{false} if not.
  1709.     \indexeditem{seteditable}{\sym{txt} \cmd{setEditable} \sym{bool}}
  1710.         Set the edit permition flag of the text widget.
  1711.      \indexeditem{setsource}{\sym{txt} \cmd{setSource} \sym{ref} \sym{top} \sym{ins}}
  1712.         Set the text edited/displayed by this widget to the one
  1713.         that is also edited/displayed by the text widget
  1714.         \sym{ref}.
  1715.         The text will be scrolled such that the top charactere
  1716.         will be \sym{top}, and the insertion cursor positionned
  1717.         at \sym{ins}.
  1718. \end{description}
  1719. \subsubsection*{Resources}
  1720. \begin{rsrctable}{xmText}
  1721.     \idx{-autoShowCursorPosition}    &    \cmd{True}    &    \sym{Boolean} \\
  1722.     \idx{-cursorPosition}            &    \cmd{0}        &    \sym{Integer} \\
  1723.     \idx{-editable}                    &   \cmd{True}  &   \sym{Boolean} \\
  1724.     \idx{-editMode}                    & \cmd{single\_line\_edit}
  1725.                                                     & \idy{multiple\_line\_edit}, \\
  1726.                                     &                & \idy{single\_line\_edit}. \\
  1727.     \idx{-marginHeight}                &   \cmd{5}     &   \sym{Integer} \\
  1728.     \idx{-marginWidth}                &   \cmd{5}     &   \sym{Integer} \\
  1729.     \idx{-maxLength}                & \sym{maxint}  &   \sym{Integer} \\
  1730.     \idx{-source}                    &  new source    &   \sym{Text Source} \\
  1731.     \idx{-topCharacter}                &   \cmd{0}     &   \sym{Integer} \\
  1732.     \idx{-value}                    &    \cmd{""}    &    \sym{String} \\
  1733.     \idx{-verifyBell}                &   \cmd{True}  &   \sym{Boolean} \\
  1734. \end{rsrctable}
  1735. \begin{rsrctable}{xmTextInput}
  1736.     \idx{-pendingDelete}            &   \cmd{True}  &   \sym{Boolean} \\
  1737.     \idx{-selectionArray}            &    not supported &    \\
  1738.     \idx{-selectionArrayCount}        &    not supported &    \\
  1739.     \idx{-selectThreshold}            &   \cmd{5}     &   \sym{Integer} \\
  1740. \end{rsrctable}
  1741. \begin{rsrctable}{xmTextOutput}
  1742.     \idx{-blinkRate}                &  \cmd{500}ms    &    \sym{Integer} \\
  1743.     \idx{-columns}                    & computed from \cmd{-width} &       \sym{Integer} \\
  1744.     \idx{-cursorPositionVisible}    &   \cmd{True}  &   \sym{Boolean} \\
  1745.     \idx{-fontList}                    &  Inherited    &    \sym{Font list} \\
  1746.     \idx{-resizeHeight}                &  \cmd{False}    &   \sym{Boolean} \\
  1747.     \idx{-resizeWidth}                &  \cmd{False}    &   \sym{Boolean} \\
  1748.     \idx{-rows}                        & computed from \cmd{-height} &     \sym{Integer} \\
  1749.     \idx{-wordWrap}                    &  \cmd{False}    &   \sym{Boolean} \\
  1750. \end{rsrctable}
  1751. The \cmd{xmText} widget inherits resources from two abstract classes,
  1752. \idx{xmTextInput} and \idx{xm\-Text\-Output}.
  1753. \cmd{xmTextField} use the resource subset that correspond to single-line
  1754. text (e.g. it does not have a \cmd{-editMode} resource).
  1755. The text source resource might be used to open multiple windows editing a 
  1756. single text, as in the exemple below~: \note{It needs a convertion to/from Pointer !}
  1757. \begin{tclmode}
  1758.     xmPanedWindow .top managed
  1759.     xmScrolledText .top.a managed \
  1760.         -editMode multi_line_edit \
  1761.         -value {Que j'aime a faire apprendre un nombre utile aux sages,
  1762.                 Immortel Archimede, artiste, ingenieur, 
  1763.                 qui de ton jugement peut priser la valeur,
  1764.                 pour moi il eu de serieux avantages.}
  1765.     xmScrolledText .top.b managed \
  1766.         -editMode multi_line_edit
  1767.     .top.b setSource .top.a 0 0
  1768. \end{tclmode}
  1769. The \cmd{xmTextInput} and \cmd{xmTextOutput} abstract classes are just used
  1770. to group resources dedicated to text editing or displaying.
  1771. Large text should be displayed or edited with the \cmd{xmScrolledText} 
  1772. widget, which automatically 
  1773. provides scroll bars when needed.
  1774. \medskip
  1775. Furthermore, text widgets inherit any resources defined in the
  1776. Core (page~\pageref{rsrc:Core}), 
  1777. Primitive (page~\pageref{rsrc:Primitive}), 
  1778. and \cmd{xmLabel} (page~\pageref{rsrc:xmLabel}) classes.
  1779. \begin{center}\begin{tabular}{lc|lc}
  1780.     \cmd{-accelerators}            & (Core)    &
  1781.     \cmd{-alignment}            & (Label)    \\
  1782.     \cmd{-backgroundPixmap}        & (Core)    &
  1783.     \cmd{-background}            & (Core)    \\
  1784.     \cmd{-borderColor}            & (Core)    &
  1785.     \cmd{-borderWidth}            & (Core)    \\
  1786.     \cmd{-bottomShadowColor}    & (Primitive)    &
  1787.     \cmd{-bottomShadowPixmap}    & (Primitive)    \\
  1788.     \cmd{-fontList}                & (Label)    &
  1789.     \cmd{-foreground}            & (Primitive)    \\
  1790.     \cmd{-heigth}                & (Core)    &
  1791.     \cmd{-highlightColor}        & (Primitive)    \\
  1792.     \cmd{-highlightOnEnter}        & (Primitive)    &
  1793.     \cmd{-highlightPixmap}        & (Primitive)    \\
  1794.     \cmd{-highlightThickness}    & (Primitive)    &
  1795.     \cmd{-labelPixmap}            & (Label)    \\
  1796.     \cmd{-labelString}            & (Label)    &
  1797.     \cmd{-labelType}            & (Label)    \\
  1798.     \cmd{-mappedWhenManaged}    & (Core)    &
  1799.     \cmd{-marginBottom}            & (Label)    \\
  1800.     \cmd{-marginLeft}            & (Label)    &
  1801.     \cmd{-marginRight}            & (Label)    \\
  1802.     \cmd{-marginTop}            & (Label)    &
  1803.     \cmd{-navigationType}        & (Primitive)    \\
  1804.     \cmd{-recomputeSize}        & (Label)    &
  1805.     \cmd{-sensitive}            & (Core)    \\
  1806.     \cmd{-shadowThickness}        & (Primitive)    &
  1807.     \cmd{-stringDirection}        & (Label)    \\
  1808.     \cmd{-topShadowColor}        & (Primitive)    &
  1809.     \cmd{-topShadowPixmap}        & (Primitive)    \\
  1810.     \cmd{-translations}            & (Core)    &
  1811.     \cmd{-traversalOn}            & (Primitive)    \\
  1812.     \cmd{-unitType}                & (Primitive)    &
  1813.     \cmd{-width}                & (Core)    \\
  1814.     \cmd{-x}                    & (Core)    &
  1815.     \cmd{-y}                    & (Core)    \\
  1816. \end{tabular}\end{center}
  1817. %-------------------------------------
  1818. \subsubsection*{Text verify callbacks}
  1819. The text widgets allows special processing by the application of text
  1820. entered.
  1821. After a character has been typed, or text pasted in, initial
  1822. processing by the Text widget determines what the user is
  1823. entering. This text is then passed to special callback
  1824. functions. These functions can make copies of the text, can
  1825. alter it, or can set a flag to say do not display it. Simple
  1826. uses for this are a password entry widget that reads the text
  1827. but does not display it (or echoes `\cmd{*}' instead), or text
  1828. formatting widgets.
  1829. The callback mechanism for this is basically the same as for
  1830. other callbacks, and similar sorts of substitutions are
  1831. allowed. For example, the term \cmd{\%currInsert} is replaced
  1832. by the current insertion position.  Other substitutions do not
  1833. give a value, but rather give the name of a \Tcl\ variable.
  1834. This allows the application to change the value as required.
  1835. For example, to turn off echoing of characters, 
  1836. the following should be done~:
  1837. \begin{tclmode}
  1838.     .text modifyVerifyCallback {
  1839.            set %doit false
  1840. \end{tclmode}
  1841. An alternate style would have been to call a separate procedure
  1842. to handle the work to be done.
  1843. The \Tcl\ variable is in the context of the callback caller, so
  1844. \cmd{upvar} should be used~:
  1845. \begin{tclmode}
  1846.     .text modifyVerifyCallback {no_echo %doit}
  1847.     proc no_echo {doit} {
  1848.            upvar 1 $doit do_insert
  1849.            set do_insert false
  1850. \end{tclmode}
  1851. Actually, the \Tcl\ variable here is the global variable
  1852. \cmd{\_Tm\_Text\_Doit}.  For this reason, variables beginning with
  1853. \cmd{\_Tm\_} are reserved for use by the \Tm\ library.
  1854. %-------------------------
  1855. \subsubsection*{Callbacks}
  1856. The supported callbacks are~:
  1857. \begin{center}\begin{tabular}{|l|l|}
  1858. \hline %------------------------------------------------------------------
  1859.     Method name                    & Why \\
  1860. \hline %------------------------------------------------------------------
  1861.            \idx{helpCallback}    & The help key is pressed. \\
  1862.         \idx{destroyCallback}    & Widget is destroyed. \\
  1863.        \idx{activateCallback}    & Some event trigger the Activate action. \\
  1864.     \idx{gainPrimaryCallback}    & Ownership of the primary selection is gained. \\
  1865.     \idx{losePrimaryCallback}    & Ownership of the primary selection is loosed. \\
  1866.     \idx{losingFocusCallback}    & Before losing input focus. \\
  1867.    \idx{modifyVerifyCallback}    & Before deletion or insertion. \\
  1868.    \idx{motionVerifyCallback}    & Before moving the insertion point. \\
  1869.    \idx{valueChangedCallback}    & Some text was deleted or inserted. \\
  1870. \hline %------------------------------------------------------------------
  1871. \end{tabular}\end{center}
  1872. The following callbacks substitutions are defined for the text
  1873. specific callbacks~:
  1874. \begin{description}
  1875.     \item{\idx{\%doit}}\dopar
  1876.             In a verify callback, the variable name of the flag to 
  1877.             know if we should do it.
  1878.     \item[\idx{\%currInsert}, \idx{\%newInsert}] \dopar
  1879.             In a \cmd{motionVerifyCallback}, the insertion point before
  1880.             and after the projected motion.
  1881.     \item[\idx{\%startPos}, \idx{\%endPos}] \dopar
  1882.             Define a substring in the widget's text string.
  1883.     \item[\idx{\%ptr}, \idx{\%length}] \dopar
  1884.         Define the string which is to be modifyed, in a
  1885.         \cmd{modifyVerify} callback.
  1886.         For instance, the 
  1887.         following example may be used to chande inputs to uppercase~:
  1888.         \begin{tclmode}
  1889.         proc allcaps {ptr length} {
  1890.            upvar 1 $ptr p
  1891.            upvar 1 $length l
  1892.            if {$l == 0} return
  1893.            set upper [string toupper $p]
  1894.            set p $upper
  1895.         .text modifyVerifyCallback {allcaps %ptr %length}
  1896.         \end{tclmode}
  1897. \end{description}
  1898. In addition, text widgets inherit callbacks from
  1899. the Primitive class, namely help
  1900. and destroy callbacks.
  1901. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1902. %----------------------
  1903. \subsection{Buttons}
  1904. \titles{Buttons}
  1905. \index{button@Button}
  1906. \Motif\ use several flavors of the button to be pushed, namely~:
  1907. \begin{description}
  1908.     \index{push button@Push button|see \cmd{xmPushButton}}
  1909.     \label{class:xmPushButton}
  1910.     \indexeditem{xmpushbutton}{\cmd{xmPushButton}}
  1911.         The regular button, displaying a text or pixmap label,
  1912.         surrounded by a beveled shadow. When focus is gained,
  1913.         the button appear brighter, if it is sensitive.
  1914.             \window{button_push}
  1915.         Pressing the mouse change the shadow to make the
  1916.         impression that the button ase been pushed in, when
  1917.         mouse is released, the button appear normal.
  1918.         The default push buttons of a dialog may be specified
  1919.         by \cmd{-showAsDefault true}, in which case an
  1920.         additional border is drawn using the margin
  1921.         resources.
  1922.     \index{arrow@Arrow|see \cmd{xmArrowButton}}
  1923.     \indexeditem{xmarrowbutton}{\cmd{xmArrowButton}}
  1924.         A button showing an arrow, whose direction is given by
  1925.         the \cmd{-arrow\linebreak[0]Direction} resource.
  1926.             \window{button_arrow}
  1927.     \index{toggle button@Toggle button|see \cmd{xmToggleButton}}
  1928.     \index{radio button@Radio button|see \cmd{xmToggleButton}}
  1929.     \index{choice@Choice|see \cmd{xmToggleButton}}
  1930.     \indexeditem{xmtogglebutton}{\cmd{xmToggleButton}}
  1931.         A button, which displays a state in an on/off
  1932.         indicator.  Usually, a toggle button consist of a
  1933.         square or diamond indicator with an associated label.
  1934.             \window{button_toggle}
  1935.         An empty or filled indicator, or a different pixmap may
  1936.         be used to indicates the selected/unselected state of
  1937.         the button.
  1938.         A set of ``radio buttons'' might be grouped into a
  1939.         manager (see section~\ref{sec:managers}), with the
  1940.         \cmd{-radioBehavior} set to \cmd{True}, to ensure that
  1941.         only one of them will be selected at a given time.  If
  1942.         the manager's \cmd{-radioAlwaysOne} resource is also
  1943.         set, then there will alway be exactly one toggle button
  1944.         set.
  1945. \end{description}
  1946. \subsubsection*{Resources}
  1947. Button resources are~:
  1948. \begin{rsrctable}{xmPushButton}
  1949.   \idx{-armColor}                        &   computed    & \sym{Color}        \\
  1950.   \idx{-armPixmap}                        &  \sym{none}    & \sym{Pixmap}        \\
  1951.   \idx{-defaultButtonShadowThickness}    &    \cmd{0}        & \sym{Dimension}    \\
  1952.   \idx{-fillOnArm}                        &  \cmd{True}    & \sym{Boolean}        \\
  1953.   \idx{-multiClick}                        &                & \idy{multiclick\_discard} \\
  1954.                                         &                & \idy{multiclick\_keep}    \\
  1955.   \idx{-showAsDefault}                    &    \cmd{0}        & \sym{Dimension}    \\
  1956. \end{rsrctable}
  1957. \begin{rsrctable}{xmArrowButton}
  1958.   \idx{-arrowDirection}                    & \cmd{arrow\_up}& \idy{arrow\_up}    \\
  1959.                                           &                & \idy{arrow\_down}    \\
  1960.                                         &                & \idy{arrow\_left}    \\
  1961.                                         &                & \idy{arrow\_right}    \\
  1962. \end{rsrctable}
  1963. \begin{rsrctable}{xmToggleButton}
  1964.   \idx{-fillOnSelect}                    & \cmd{True}    & \sym{Boolean} \\
  1965.   \idx{-indicatorOn}                    & \cmd{True}    & \sym{Boolean} \\
  1966.   \idx{-indicatorSize}                    &  \sym{none}    & \sym{Dimension} \\
  1967.   \idx{-indicatorType}                    &\cmd{n\_of\_many}& \idy{n\_of\_many} \\
  1968.                                           &                 & \idy{one\_of\_many} \\
  1969.   \idx{-selectColor}                    &     computed    & \sym{Color} \\
  1970.   \idx{-selectInsensitivePixmap}         & \sym{none}    & \sym{Pixmap} \\
  1971.   \idx{-selectPixmap}                    & \sym{none}    & \sym{Pixmap} \\
  1972.   \idx{-set}                            & \sym{False}    & \sym{Boolean} \\
  1973.   \idx{-spacing}                        &    \cmd{4}        & \sym{Dimension} \\
  1974.   \idx{-visibleWhenOff}                    &   computed    & \sym{Boolean} \\
  1975. \end{rsrctable}
  1976. Furthermore, text widgets inherit any resources defined in the
  1977. Core (page~\pageref{rsrc:Core}), 
  1978. Primitive (page~\pageref{rsrc:Primitive}), 
  1979. and Label (page~\pageref{rsrc:xmLabel}) classes.
  1980. \begin{center}\begin{tabular}{lc|lc}
  1981.     \cmd{-accelerators}            & (Core)    &
  1982.     \cmd{-allignment}            & (Label)    \\
  1983.     \cmd{-backgroundPixmap}        & (Core)    &
  1984.     \cmd{-background}            & (Core)    \\
  1985.     \cmd{-borderColor}            & (Core)    &
  1986.     \cmd{-borderWidth}            & (Core)    \\
  1987.     \cmd{-bottomShadowColor}    & (Primitive)    &
  1988.     \cmd{-bottomShadowPixmap}    & (Primitive)    \\
  1989.     \cmd{-fontList}                & (Label)    &
  1990.     \cmd{-foreground}            & (Primitive)    \\
  1991.     \cmd{-heigth}                & (Core)    &
  1992.     \cmd{-highlightColor}        & (Primitive)    \\
  1993.     \cmd{-highlightOnEnter}        & (Primitive)    &
  1994.     \cmd{-highlightPixmap}        & (Primitive)    \\
  1995.     \cmd{-highlightThickness}    & (Primitive)    &
  1996.     \cmd{-labelPixmap}            & (Label)    \\
  1997.     \cmd{-labelString}            & (Label)    &
  1998.     \cmd{-labelType}            & (Label)    \\
  1999.     \cmd{-mappedWhenManaged}    & (Core)    &
  2000.     \cmd{-marginBottom}            & (Label)    \\
  2001.     \cmd{-marginHeight}            & (Label)    &
  2002.     \cmd{-marginLeft}            & (Label)    \\
  2003.     \cmd{-marginRight}            & (Label)    &
  2004.     \cmd{-marginRight}            & (Label)    \\
  2005.     \cmd{-marginTop}            & (Label)    &
  2006.     \cmd{-navigationType}        & (Primitive)    \\
  2007.     \cmd{-recomputeSize}        & (Label)    &
  2008.     \cmd{-sensitive}            & (Core)    \\
  2009.     \cmd{-shadowThickness}        & (Primitive)    &
  2010.     \cmd{-stringDirection}        & (Label)    \\
  2011.     \cmd{-topShadowColor}        & (Primitive)    &
  2012.     \cmd{-topShadowPixmap}        & (Primitive)    \\
  2013.     \cmd{-translations}            & (Core)    &
  2014.     \cmd{-traversalOn}            & (Primitive)    \\
  2015.     \cmd{-unitType}                & (Primitive)    &
  2016.     \cmd{-width}                & (Core)    \\
  2017.     \cmd{-x}                    & (Core)    &
  2018.     \cmd{-y}                    & (Core)    \\
  2019. \end{tabular}\end{center}
  2020. \subsubsection*{Callbacks}
  2021. In addition to the usual \cmd{helpCallback} and \cmd{destroyCallback},
  2022. button widgets define the following new ones~:
  2023. \begin{center}\begin{tabular}{|l|l|}
  2024. \hline %------------------------------------------------------------------
  2025.                     Method name    & Why \\
  2026. \hline %------------------------------------------------------------------
  2027.                \idx{armCallback}    & Button pressed. \\
  2028.          \idx{disarmCallback}    & Button released, when the pointer still on it. \\
  2029.        \idx{activateCallback}    & Some event triger the Activate function. \\
  2030. \hline %------------------------------------------------------------------
  2031. \end{tabular}\end{center}
  2032. The toggle button also define the \cmd{\%set} callback substitution,
  2033. which is replaced by the boolean state of the button.
  2034. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2035. %------------------------
  2036. \subsection{Decorativ widgets}
  2037. \titles{Decorativ widgets}
  2038. \index{xmframe@\cmd{xmFrame}}
  2039. \index{box@Box |see \cmd{xmFrame}}
  2040. \index{xmseparator@\cmd{xmSeparator}}
  2041. Simple decorativ widgets include \idx{xmFrame} and \idx{xmSeparator}.
  2042. The former is simply a container widget that display a frame around
  2043. its child, using in/out shadowing or etching.
  2044. The later is a primitive widget that look like a flat or beveled line~; it
  2045. is used t separates items in a display.
  2046. This two widget classes do not interact with user input, hence they
  2047. do not have actions, callbacks or translations.
  2048. New decoration resources are~:
  2049. \begin{rsrctable}{xmFrame}
  2050.   \idx{-marginWidth}    &    \cmd{0}        &    \sym{Dimension}    \\
  2051.   \idx{-marginHeight}    &    \cmd{0}        &    \sym{Dimension}    \\
  2052.   \idx{-shadowType}        &    dynamic        &   \idy{shadow\_in}    \\
  2053.                         &                &   \idy{shadow\_out}    \\
  2054.                         &                &    \idy{shadow\_etched\_in}\\
  2055.                         &                &    \idy{shadow\_etched\_out}\\
  2056. \end{rsrctable}
  2057. \begin{rsrctable}{xmSeparator}
  2058.   \idx{-margin}            &    \cmd{0}        &    \sym{Dimension}    \\
  2059.   \idx{-orientation}    &\cmd{horizontal}
  2060.                                           &    \idy{horizontal}    \\
  2061.                         &                &    \idy{vertical}    \\
  2062.   \idx{-separatorType}    & \cmd{shadow\_etched\_in}
  2063.                                           &    \idy{shadow\_etched\_in} \\
  2064.                         &                &    \idy{shadow\_etched\_out}\\
  2065.                         &                &    \idy{no\_line}        \\
  2066.                         &                &    \idy{single\_line}    \\
  2067.                         &                &    \idy{double\_line}    \\
  2068.                         &                &    \idy{single\_dashed\_line}\\
  2069.                         &                &    \idy{double\_dashed\_line}\\
  2070. \end{rsrctable}
  2071. In addition, they inherit the following resources from the
  2072. Primitive (page~\pageref{rsrc:Primitive}),
  2073. and Core classes (page~\pageref{rsrc:Core})~:
  2074. \begin{center}\begin{tabular}{lc|lc}
  2075.     \cmd{-backgroundPixmap}        & (Core)    \\
  2076.     \cmd{-background}            & (Core)    &
  2077.     \cmd{-borderColor}            & (Core)    \\
  2078.     \cmd{-borderWidth}            & (Core)    &
  2079.     \cmd{-bottomShadowColor}    & (Primitive)    \\
  2080.     \cmd{-bottomShadowPixmap}    & (Primitive)    &
  2081.     \cmd{-foreground}            & (Primitive)    \\
  2082.     \cmd{-heigth}                & (Core)    &
  2083.     \cmd{-mappedWhenManaged}    & (Core)    \\
  2084.     \cmd{-shadowThickness}        & (Primitive)    &
  2085.     \cmd{-topShadowColor}        & (Primitive)    \\
  2086.     \cmd{-topShadowPixmap}        & (Primitive)    &
  2087.     \cmd{-unitType}                & (Primitive)    \\
  2088.     \cmd{-width}                & (Core)    &
  2089.     \cmd{-x}                    & (Core)    \\
  2090.     \cmd{-y}                    & (Core)    &
  2091. \end{tabular}\end{center}
  2092. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2093. %-----------------------------------------------------------------
  2094. \subsection{\cmd{xmList}}
  2095. \titles{\cmd{xmList}}
  2096. \index{xmlist@\cmd{xmList}}
  2097. \index{xmscrolledlist@\cmd{xmScrolledList} |see \cmd{xmList}}
  2098. \index{item@Item |see \cmd{xmList}}
  2099. A list is used to display an ordered set of strings.
  2100. Mouse or keyboard intercation permit to select item(s).
  2101. \medskip
  2102. A \cmd{xmScrolledList} should be used when the number of item may be too 
  2103. large to display in the alloted space in the interface~: the interface is 
  2104. automatically changed to display a \cmd{xmScrollBar} (see below) to move 
  2105. the visible part of the list.
  2106. A scrolled list widget \sym{w} is a composite widget that have the 
  2107. following childrens~:
  2108. \begin{center}\begin{tabular}{lll}
  2109.     \sym{w}\cmd{.HorScrollBar} & \sym{w}\cmd{.VertScrollBar} & \sym{w}\cmd{.ClipWindow}    \\
  2110. \end{tabular}\end{center}
  2111. The associated names might be used to directly access them, as in the 
  2112. following example~:
  2113. \begin{tclmode}
  2114.     xmScrolledList .list managed
  2115.     .list.VertScrollBar setValues -troughColor red
  2116. \end{tclmode}
  2117. \medskip
  2118. Different selection mode exist~:
  2119. \begin{description}
  2120.     \defx{-selectionPolicy}
  2121.     \item[\idy{single\_select}] \dopar
  2122.         Only one item may be selected at any time. 
  2123.         A button click in the list deselect any previous selection, 
  2124.         and select that item. 
  2125.         Each time a selection is made,
  2126.         \cmd{singleSelectionCallback} is called.
  2127.     \item[\idy{multiple\_select}] \dopar
  2128.         Shift-clicks may be used to ma\-ke multiple selections. 
  2129.         \cmd{multiple\-Selection\-Callback} is called each time an 
  2130.         item is selected or unselected. 
  2131.     \item[\idy{extended\_select}] \dopar
  2132.         Any single mouse click deselect anything, and select the 
  2133.         current item. 
  2134.         Any shift-click extend the current selection up to the 
  2135.         item underbeneath the mouse. 
  2136.         \noindent
  2137.         \cmd{extendedSelectionCallback} is called for each item selection
  2138.         or deselection.
  2139.     \item[\idy{browse\_select}] \dopar
  2140.         Mouse dragging may be used to select a range of items. 
  2141.         Using shift-cli\-cks or shift-drags, more than one range  
  2142.         may be selected at a given time. 
  2143.         \noindent
  2144.         \cmd{browseSelectionCallback} is called for each 
  2145.         newly selected item, once mouse button is released. 
  2146.         \noindent
  2147.         This is the default mode.
  2148. \end{description}
  2149. In all mode, the \cmd{defaultActionCallback} is called when the
  2150. user double-click on an item.
  2151. The following methods are provided to manage the selection list~:
  2152. \begin{description}
  2153.     \indexeditem{additem}{\sym{list} \cmd{addItem} \sym{item} \sym{position}}
  2154.         Add the specified \sym{item} (any \Tcl string value) to the 
  2155.         existing list, at the given \sym{position}.
  2156.         If \sym{position} is 1 or greater, the new item will be the 
  2157.         first one, second one, ...
  2158.         If \sym{position} is 0, the insertion is made at the end.
  2159.      \indexeditem{additemunselected}{\sym{list} \cmd{addItemUnselected} \sym{item} \sym{position}}
  2160.         Normally, if you an item already selected, the second instance
  2161.         will also be selected. this method ensure that the newly
  2162.         inserted item will not be selected.
  2163.     \indexeditem{deleteposition}{\sym{list} \cmd{deletePosition} \sym{position}}
  2164.         Delete the item specified by \sym{position}.
  2165.         If \sym{position} is 0, the last item is deleted.
  2166.     \indexeditem{deleteitem}{\sym{list} \cmd{deleteItem} \sym{item}}
  2167.         Delete the first occurence of \sym{item} in the list.
  2168.         A warning will occur if the item does not exist.
  2169.     \indexeditem{deleteallitems}{\sym{list} \cmd{deleteAllItems}}
  2170.         Delete all items in the list.
  2171.     \indexeditem{selectposition}{\sym{list} \cmd{selectPosition} \sym{position} \sym{notify}}
  2172.         Select the item at the given \sym{po\-si\-tion} in the list.
  2173.         If \sym{notify} is \cmd{true}, the corresponding 
  2174.         callback is called. 
  2175.     \indexeditem{selectitem}{\sym{list} \cmd{selectItem} \sym{item} \sym{notify}}
  2176.         Select the first given item in the list.
  2177.         If \sym{notify} is \cmd{true}, the corresponding 
  2178.         callback is called. 
  2179.     \indexeditem{deselectitem}{\sym{list} \cmd{deselectItem} \sym{item}}
  2180.         Deselect the first given item in the list. If the item is at 
  2181.         multiple position in the list, only the first occurence is
  2182.         deselected (even if it's not the selected one !).
  2183.     \indexeditem{deselectposition}{\sym{list} \cmd{deselectPosition} \sym{position}}
  2184.         Deselect the item at the given position in the list.
  2185.     \indexeditem{itemexists}{\sym{list} \cmd{itemExists} \sym{item}}
  2186.         Reply \cmd{true} if the \sym{item} is in the list, 
  2187.         \cmd{false} if not.
  2188.     \indexeditem{itemposition}{\sym{list} \cmd{itemPosition} \sym{item}}
  2189.         Return the position in th elist of the given \sym{item},
  2190.         or \cmd{0} if it does not exists.
  2191.     \indexeditem{positionselected}{\sym{list} \cmd{positionSelected} \sym{position}}
  2192.          Reply \cmd{true} if the \sym{position} is currently selected,
  2193.          \cmd{false} if not.
  2194.     \indexeditem{setitem}{\sym{list} \cmd{setItem} \sym{item}}
  2195.         Scroll the list so that the first occurence of \sym{item}
  2196.         will be at the top of the currently displayed part of
  2197.         the list.
  2198.     \indexeditem{setposition}{\sym{list} \cmd{setPosition} \sym{position}}
  2199.         Scroll the list so that the \sym{position}'th item
  2200.         will be at the top of the currently displayed part of
  2201.         the list.
  2202.     \indexeditem{setbottomitem}{\sym{list} \cmd{setBottomItem} \sym{item}}
  2203.         Scroll the list so that the first occurence of \sym{item}
  2204.         will be at the bottom of the currently displayed part of
  2205.         the list.
  2206.     \indexeditem{setbottomposition}{\sym{list} \cmd{setBottomPosition} \sym{position}}
  2207.         Scroll the list so that the \sym{position}'th item
  2208.         will be at the bottom of the currently displayed part of
  2209.         the list.
  2210. \end{description}
  2211. \subsubsection*{Resources}
  2212. List specific resources are~:
  2213. \begin{rsrctable}{xmList}
  2214.   \idx{-automaticSelection}        &  \cmd{False}    & \sym{Boolean}    \\
  2215.   \idx{-doubleClickInterval}    &  Inherited    & \sym{Integer}    \\
  2216.   \idx{-fontList}                &  Inherited    & \sym{Font List} \\
  2217.   \idx{-itemCount}                &    computed    & \sym{Integer} \\
  2218.   \idx{-items}                    &    \sym{none}    & \sym{String array} \\
  2219.   \idx{-listMarginHeight}         &    \cmd{0}        & \sym{Integer}    \\
  2220.   \idx{-listMarginWidth}        &    \cmd{0}        & \sym{Integer}    \\
  2221.   \idx{-listSizePolicy}\co        & \cmd{variable}& \idy{constant} \\
  2222.                                 &                 & \idy{resize\_if\_possible} \\
  2223.                                 &                 & \idy{variable} \\
  2224.   \idx{-listSpacing}            &    \cmd{0}        & \sym{Integer}    \\
  2225.   \idx{-scrollBarDisplayPolicy} &\cmd{as\_needed}& \idy{as\_needed} \\
  2226.                                   &                & \idy{static} \\
  2227.   \idx{-selectedItemCount}         &    \cmd{0}        & \sym{Integer} \\
  2228.   \idx{-selectedItems}            &   \sym{none}    & \sym{String array} \\
  2229.   \idx{-selectionPolicy}        & \cmd{browse\_select}
  2230.                                                   & \cmd{browse\_select} \\
  2231.                                   &                & \cmd{extended\_select} \\
  2232.                                   &                & \cmd{multiple\_select} \\
  2233.                                   &                & \cmd{single\_select} \\
  2234.   \idx{-stringDirection}        &    Inherited    & \idy{string\_direction\_l\_to\_r} \\
  2235.                                   &                & \idy{string\_direction\_r\_to\_l} \\
  2236.   \idx{-topItemPosition}        &   \cmd{1}        & \sym{Integer} \\
  2237.   \idx{-visibleItemCount}        &    \cmd{1}        & \sym{Integer} \\
  2238. \end{rsrctable}
  2239. Other resources are derived from the
  2240. Core (page~\pageref{rsrc:Core}), 
  2241. Primitive (page~\pageref{rsrc:Primitive}), 
  2242. and Label (page~\pageref{rsrc:xmLabel}) classes.
  2243. \subsubsection*{Callbacks}
  2244. List specific supported callbacks are~:
  2245. \begin{center}\begin{tabular}{|l|l|}
  2246.     \hline %------------------------------------------------------------------
  2247.                     Method name    & Why \\
  2248.     \hline %------------------------------------------------------------------
  2249.         \idx{defaultActionCallback}    & An item was double-clicked. \\
  2250.       \idx{singleSelectionCallback}    & An single item was selected. \\
  2251.     \idx{multipleSelectionCallback}    & An item was selected, \\
  2252.       \idx{browseSelectionCallback}    & when in the corresponding \\
  2253.     \idx{extendedSelectionCallback} & selection mode. \\
  2254.     \hline %------------------------------------------------------------------
  2255. \end{tabular}\end{center}
  2256. The following substitutions are defined for this callbacks~:
  2257. \begin{description}
  2258.     \item[\idx{\%item}] \dopar
  2259.         The currently selected item string.
  2260.     \item[\idx{\%item\_length}] \dopar
  2261.         The string length of the currently selected item.
  2262.     \item[\idx{\%item\_position}] \dopar
  2263.         The current item position, \cmd{1} indicating the first one.
  2264.     \item[\idx{\%selected\_items}] \dopar
  2265.         Valid only in multiple, browse or extended callbacks,
  2266.         this substitution returns a comma-separated list of all
  2267.         currently selected items.
  2268. \end{description}
  2269. Care should be take to enclose \cmd{\%item} and \cmd{\%selected\_items}
  2270. between braces, to avoid parsing error when item string contain
  2271. spaces.
  2272. \medskip
  2273. In addition, text widgets inherit the standard callbacks from
  2274. the Primitive class, namely \cmd{helpCallback} 
  2275. and \cmd{destroyCallback}.
  2276. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2277. \subsection{\cmd{xmScale}}
  2278. \titles{\cmd{xmScale}}
  2279. \index{xmscale@\cmd{xmScale}}
  2280. \index{slider@Slider |see \cmd{xmScale}}
  2281. A scale widget display a cursor that can be moved between
  2282. a minimal and a maximal value.
  2283.         \window{scale}
  2284. \subsubsection*{Resources}
  2285. The scale widget class define the new resources given below.
  2286. \begin{rsrctable}{xmScale}
  2287.   \idx{-decimalPoints}            &    \cmd{0}        & \sym{Integer}        \\
  2288.   \idx{-fontList}                 & Inherited        & \sym{Font List}    \\
  2289.   \idx{-highlightOnEnter}         &  \cmd{False}    & \sym{Boolean}        \\
  2290.   \idx{-highlightThickness}     &    \cmd{2}        & \sym{Dimension}    \\
  2291.   \idx{-maximum}                &    \cmd{100}    & \sym{Integer}        \\
  2292.   \idx{-minimum}                &    \cmd{0}        &\sym{Integer}        \\
  2293.   \idx{-orientation}            & \cmd{vertical}& \idy{horizontal}    \\
  2294.                                   &                & \idy{vertival}    \\
  2295.   \idx{-processsingDirection}    &    computed    & \idy{max\_on\_bottom}\\
  2296.                                   &                & \idy{max\_on\_left}    \\
  2297.                                   &                & \idy{max\_on\_right}\\
  2298.                                   &                & \idy{max\_on\_top}    \\
  2299.   \idx{-scaleHeight}            &    \cmd{0}        & \sym{Dimension}    \\
  2300.   \idx{-scaleWidth}                &    \cmd{0}        & \sym{Dimension}    \\
  2301.   \idx{-scaleMultiple}            & $(max-min)/10$& \sym{Integer}        \\
  2302.   \idx{-showValue}                &    \cmd{False}    & \sym{Boolean}        \\
  2303.   \idx{-titleString}            &    \cmd{""}    & \sym{String}        \\
  2304.   \idx{-value}                    &    \cmd{0}        & \sym{Integer}        \\
  2305. \end{rsrctable}
  2306. The slider may be moved between the integer \cmd{-minimum} and
  2307. \cmd{-maximum}. Fractional values are obtained using the
  2308. \cmd{-decimalPoints} resource, to display a decimal point.
  2309. The slider size may be set by \cmd{-scaleHeight} and \cmd{-scaleWidth}.
  2310. \cmd{-showValue} tells to display a textual readout of the current
  2311. value.
  2312. \cmd{-scaleMultiple} is used for large slider move (Control-arrow on 
  2313. the keyboard).
  2314. \subsubsection*{Callbacks}
  2315. \begin{center}\begin{tabular}{|l|l|}
  2316.     \hline %------------------------------------------------------------------
  2317.                         Method name    & Why \\
  2318.     \hline %------------------------------------------------------------------
  2319.        \idx{valueChangedCallback}    & The scale value had changed. \\
  2320.                \idx{dragCallback}    & The slider is being dragged. \\
  2321.     \hline %------------------------------------------------------------------
  2322. \end{tabular}\end{center}
  2323. In this callbacks, the \idx{\%value} substitution may be used to
  2324. retrieve the current scale position.
  2325. In addition, \cmd{xmScale} inherits the usual \idx{helpCallback} from
  2326. the Primitive abstract class.
  2327. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2328. %-----------------------------------------------------------------------
  2329. \subsection{\cmd{xmScrollBar}}
  2330. \titles{\cmd{xmScrollBar}}
  2331. \index{xmscrollbar@\cmd{xmScrollBar}}
  2332. The \cmd{xmScrollBar} widget is made to allow moving the current
  2333. vue of a widget too large to be displayed at once.
  2334. Usually, scroll bars will be part of a \cmd{xmScrolledWidget}, 
  2335. \cmd{xmScrolledText} or \cmd{xmScrolledList} widget.
  2336.         \window{scrollbar}
  2337. An \cmd{xmScrollBar} may be horizontal or vertical (depending
  2338. on \cmd{-orientation}.
  2339. \index{slider@Slider |see \cmd{xmScrollBar}}
  2340. It is composed of the two arrows, a larger rectangle called the
  2341. scroll region, and a smaller one: the slider.
  2342. The data is scrolled by clicking either arrow, clicking inside
  2343. the scroll region, or dragging the slider.
  2344. When the mouse is held down in the scroll region or in either arrow,
  2345. the data continues to move at a constant speed.
  2346. The following example use two scrollbars to move a target button~:
  2347.         \ttinclude{examples/scrollbar.tcl}
  2348. \subsubsection*{Resources}
  2349. The scroll bar widget class define the new resources given below.
  2350. \begin{rsrctable}{xmScrollBar}
  2351.       \idx{-increment}                    &    \cmd{1}        & \sym{Integer}        \\
  2352.       \idx{-initialDelay}                &    \cmd{250} ms& \sym{Integer}        \\
  2353.       \idx{-maximum}                    &    \cmd{100}    & \sym{Integer}        \\
  2354.       \idx{-minimum}                    &    \cmd{0}        & \sym{Integer}        \\
  2355.       \idx{-orientation}                & \cmd{vertical}& \idy{horizontal}    \\
  2356.                                           &                 & \idy{vertical}    \\
  2357.       \idx{-pageIncrement}                &  \cmd{10}        & \sym{Integer}        \\
  2358.       \idx{-processsingDirection}        &    computed    & \idy{max\_on\_bottom}\\
  2359.                                           &                & \idy{max\_on\_left}    \\
  2360.                                           &                & \idy{max\_on\_right}\\
  2361.                                           &                & \idy{max\_on\_top}    \\
  2362.       \idx{-repeatDelay}                &    \cmd{50} ms    & \sym{Integer} \\
  2363.       \idx{-showArrows}                    &  \cmd{True}    & \sym{Boolean} \\
  2364.       \idx{-sliderSize}                    &    computed    & \sym{Integer} \\
  2365.       \idx{-troughColor}                &    computed    & \sym{Color} \\
  2366.       \idx{-value}                        &    \cmd{0}        & \sym{Integer} \\
  2367. \end{rsrctable}
  2368. The \cmd{-value} resource contains the current position of the slider's
  2369. begin, between \cmd{-minimum} and $\cmd{maximum} - \cmd{sliderSize}$.
  2370. The slider move between \cmd{-minimum} and \cmd{-maximum}, by
  2371. \cmd{-increment} steps (clipped at the ends).
  2372. Clicking either arrow move by \cmd{-pageIncrement}.
  2373. \cmd{-sliderSize} may be used to reflect the portion of the
  2374. widget which is currently in the view.
  2375. \cmd{-troughColor} is the slider fill color.
  2376. Constant speed moving is parametrized by \cmd{-repeatDeleay} and
  2377. \cmd{-initialDelay}.
  2378. If \cmd{-showArrows} is set to \cmd{False}, the scroll bar
  2379. won't have arrows on both sides.
  2380. \subsubsection*{Callbacks}
  2381. \begin{center}\begin{tabular}{|l|l|}
  2382.     \hline %------------------------------------------------------------------
  2383.                         Method name    & Why \\
  2384.     \hline %------------------------------------------------------------------
  2385.           \idx{decrementCallback}    & value was decremented. \\
  2386.                \idx{dragCallback}    & The slider is being dragged. \\
  2387.           \idx{incrementCallback}    & value was incremented. \\
  2388.       \idx{pageDecrementCallback}    & value was decremented by pageIncrement. \\
  2389.       \idx{pageIncrementCallback}    & value was incremented by pageIncrement. \\
  2390.               \idx{toTopCallback}    & value was reset to minimum. \\
  2391.            \idx{toBottomCallback}    & value was reset to maximum. \\
  2392.        \idx{valueChangedCallback}    & The value had changed. \\
  2393.     \hline %------------------------------------------------------------------
  2394. \end{tabular}\end{center}
  2395. In the corresponding callbacks, the \idx{\%value} substitution will
  2396. return the current scroll bar position.
  2397. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2398. %------------------------------------------------------------------------
  2399. \section{Manager widgets}
  2400. \label{sec:managers}
  2401. \titles{Managers}
  2402. Manager widgets are used to layout several widgets together, 
  2403. enabling to construct complex interfaces from simpler widgets.
  2404. Theyre main purpose is to find a suitable geometry that enclose
  2405. all managed children ; at creation time,
  2406. when the user manually resize the window,
  2407. or when widgets dynamically change itself.
  2408. Normaly, manager do not interact with events, they just forward them to
  2409. to appropriate child.
  2410. The notable exception is navigation~: use of keyboard to change
  2411. the currently selected children widget.
  2412. %--------------------------------------------------
  2413. \subsection{The \cmd{xmManager} abstract class}
  2414. \label{sec:manager}
  2415. \titles{\cmd{xmManager}}
  2416. \index{xmmanager@\cmd{xmManager}}
  2417. This class is not a subclass of Primitive, but have some
  2418. graphical representation, so we have a subset of Primitive's
  2419. resources and behavior here.
  2420. \subsubsection*{Resources}
  2421. The \Motif\ Manager abstract widget class is used to define the
  2422. common resource set described below.
  2423. \begin{rsrctable}{xmManager}
  2424.       \idx{-bottomShadowColor}            &                & \sym{Color}    \\
  2425.       \idx{-bottomShadowPixmap}            &  \sym{none}    & \sym{Pixmap}    \\
  2426.       \idx{-foreground}                    &  computed        & \sym{Color}    \\
  2427.       \idx{-highlightColor}                &  computed        & \sym{Color}    \\
  2428.       \idx{-highlightPixmap}            &  \sym{none}    & \sym{Pixmap}    \\
  2429.       \idx{-navigationType}                &\cmd{tab\_group}& \idy{none} \\
  2430.                                           &                & \idy{tab\_group} \\
  2431.                                           &                & \idy{sticky\_tab\_group} \\
  2432.                                           &                & \idy{exclusive\_tab\_group} \\
  2433.       \idx{-shadowThickness}            &   \cmd{0}        & \sym{Dimension}    \\
  2434.       \idx{-stringDirection}            &    Inherited    & \idy{string\_direction\_l\_to\_r} \\
  2435.                                           &                & \idy{string\_direction\_r\_to\_l} \\
  2436.       \idx{-topShadowColor}                &   computed    & \sym{Color} \\
  2437.       \idx{-topShadowPixmap}            &  \sym{none}    & \sym{Pixmap} \\
  2438.       \idx{-traversalOn}                &  \cmd{True}    & \sym{Boolean} \\
  2439.       \idx{-unitType}                    &  Inherited or \cmd{pixels}
  2440.                                                           & \idy{pixels} \\
  2441.                                           &                & \idy{100th\_millimeters} \\
  2442.                                           &                & \idy{1000th\_inches} \\
  2443.                                           &                & \idy{100th\_points} \\
  2444.                                           &                & \idy{100th\_font\_units} \\
  2445. \end{rsrctable}
  2446. \subsubsection*{Callbacks}
  2447. The Manager abstract class also defines callbacks for all 
  2448. manager subclass, descibed in the table below.
  2449. \begin{center}\begin{tabular}{|l|l|}
  2450.     \hline %------------------------------------------------------------------
  2451.                     Method name    & Why \\
  2452.     \hline %------------------------------------------------------------------
  2453.           \idx{focusCallback}    & The widget will receive input focus. \\
  2454.           \idx{helpCallback}    & The usual Help callback. \\
  2455.             \idx{mapCallback}    & The widget is mapped on screen. \\
  2456.           \idx{unmapCallback}    & The widget is unmapped from screen. \\
  2457.     \hline %------------------------------------------------------------------
  2458. \end{tabular}\end{center}
  2459. There is no special substitution associated with this callbacks.
  2460. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2461. %--------------------------------------------------
  2462. \subsection{\cmd{xmBulletinBoard}}
  2463. \titles{\cmd{xmBulletinBoard}}
  2464. \index{xmbulletinboard@\cmd{xmBulletinBoard}}
  2465. The \cmd{xmBulletinBoard} manager is the simplest one.
  2466. Children widgets are positionned using their \cmd{-x}
  2467. and \cmd{-y} resources.
  2468. There is no particular management when the widget is resized.
  2469. \subsubsection*{Resources}
  2470. \begin{rsrctable}{xmBulletinBoard}
  2471.   \idx{-allowOverlap}                &    \cmd{True}    & \sym{Boolean} \\
  2472.   \idx{-autoUnmanage}\co            &    \cmd{True}    & \sym{Boolean} \\
  2473.   \idx{-buttonFontList}                &  Inherited    & \sym{Font List} \\
  2474.   \idx{-cancelbutton}                &   \sym{none}    & \sym{Widget} \\
  2475.   \idx{-defaultbutton}                &   \sym{none}    & \sym{Widget} \\
  2476.   \idx{-defaultPosition}            &    \cmd{True}    & \sym{Boolean} \\
  2477.   \idx{-dialogStyle}                &   computed    & \small \idy{dialog\_system\_modal} \\
  2478.                                       &                 & \small \idy{dialog\_primary\_application\_modal} \\
  2479.                                       &                 & \small \idy{dialog\_application\_modal} \\
  2480.                                       &                 & \small \idy{dialog\_full\_application\_modal} \\
  2481.                                       &                 & \small \idy{dialog\_modless} \\
  2482.                                       &                 & \small \idy{dialog\_work\_area} \\
  2483.   \idx{-dialogTitle}                &  \sym{none}    & \sym{String} \\
  2484.   \idx{-labelFontList}                &  Inherited    & \sym{Font List} \\
  2485.   \idx{-marginHeight}                &    \cmd{10}    & \sym{Dimension} \\
  2486.   \idx{-marginWidth}                &    \cmd{10}    & \sym{Dimension} \\
  2487.   \idx{-noResize}                    &    \cmd{False}    & \sym{Boolean} \\
  2488.   \idx{-resizePolicy}                & any            & \idy{resize\_any} \\
  2489.                                       &                & \idy{resize\_grow} \\
  2490.                                       &                & \idy{resize\_none} \\
  2491.   \idx{-shadowType}                    & \cmd{shadow\_out}
  2492.                                                     & \idy{shadow\_in}    \\
  2493.                                     &                & \idy{shadow\_out}    \\
  2494.                                     &                & \idy{shadow\_etched\_in}\\
  2495.                                     &                & \idy{shadow\_etched\_out}\\
  2496.   \idx{-textFontList}                &   Inherited    & \sym{Font List} \\
  2497.   \idx{-textTranslations}\cro        &    \cmd{""}    & \sym{String} \\
  2498. \end{rsrctable}
  2499. When \cmd{-allowOverlap} is set to \cmd{False}, any placement of children
  2500. that would result in an overlap will be rejected.
  2501. Setting \cmd{-noResize} to \cmd{True} will disable any resize of the
  2502. widget, while \cmd{-resizePolicy} may be used to control more what kind
  2503. of resize should be allowed.
  2504. \pagebreak
  2505. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2506. %-----------------------------------------------------------
  2507. \subsection{\cmd{xmRowColumn}} \titles{\cmd{xmRowColumn}}
  2508. \index{xmrowcolumn@\cmd{xmRowColumn}}
  2509. The \cmd{xmBulletinBoard} manager place its children in one or
  2510. more columns (or rows).
  2511. Different packing styles, main direction and size options  permit to have
  2512. aligned or unaligned rows (or columns), as in the following examples~:
  2513. \begin{center}
  2514.     \small
  2515.     \begin{tabular}{ccc}
  2516.     \windowdump{rowcol_row}            & \windowdump{rowcol_array}        & \windowdump{rowcol_column} \\
  2517.     \cmd{-packing pack\_tight}        & \cmd{-packing pack\_column}    & \cmd{-orientation horizontal} \\
  2518.     \cmd{-orientation horizontal}    & \cmd{-numColumns 2}            & \\
  2519.     \end{tabular}
  2520. \end{center}
  2521. \subsubsection*{Resources}
  2522. \begin{rsrctable}{xmRowColumn}
  2523.   \idx{-adjustLast}                    &    \cmd{True}    & \sym{Boolean}    \\
  2524.   \idx{-adjustMargin}                &    \cmd{True}    & \sym{Boolean}    \\
  2525.   \idx{-entryAlignment}                & \cmd{alignment\_center}
  2526.                                                     & \idy{alignment\_center} \\
  2527.                                     &                & \idy{alignment\_beginning} \\
  2528.                                     &                & \idy{alignment\_end} \\
  2529.   \idx{-entryBorder}                &    \cmd{0}        & \sym{Integer}    \\
  2530.   \idx{-entryClass}                    &    dynamic        & \sym{Widget Class}    \\
  2531.   \idx{-isAligned}                    &    \cmd{True}    & \sym{Boolean}    \\
  2532.   \idx{-isHomogeneous}                &    \cmd{True}    & \sym{Boolean}    \\
  2533.   \idx{-labelString}\co                &    \cmd{""}    & \sym{String}    \\
  2534.   \idx{-marginHeight}                &    Inherited    & \sym{Dimension}    \\
  2535.   \idx{-marginWidth}                &    Inherited    & \sym{Dimension}    \\
  2536.   \idx{-menuAccelerator}            &    ?            & \sym{String}    \\
  2537.   \idx{-menuHelpWidget}                &  \sym{none}    & \sym{Widget}    \\
  2538.   \idx{-menuHistory}                &  \sym{none}    & \sym{Widget}    \\
  2539.   \idx{-menuPost}                    &    \cmd{""}    & \sym{String}    \\
  2540.   \idx{-mnemonic}                    &  \sym{none}    & \sym{KeySym}    \\
  2541.   \idx{-mnemonicCharSet}            & \sym{dynamic}    & \sym{String}    \\
  2542.   \idx{-numColumns}                    &    \cmd{1}        & \sym{Integer}    \\
  2543.   \idx{-orientation}                &   computed    & \idy{horizontal}    \\
  2544.                                       &                 & \idy{vertical}    \\
  2545.   \idx{-packing}                    &    computed    & \idy{pack\_column}    \\
  2546.                                       &                & \idy{pack\_none}    \\
  2547.                                       &                & \idy{pack\_tight}    \\
  2548.   \idx{-popupEnabled}                &  \cmd{True}    & \sym{Boolean}    \\
  2549.   \idx{-radioAlwaysOne}                &  \cmd{True}    & \sym{Boolean}    \\
  2550.   \idx{-radioBehavior}                &  \cmd{False}    & \sym{Boolean}    \\
  2551.   \idx{-resizeHeight}                &  \cmd{True}    & \sym{Boolean}    \\
  2552.   \idx{-resizeWidth}                &  \cmd{True}    & \sym{Boolean}    \\
  2553.   \idx{-rowColumnType}\co            &\cmd{work\_area}& \idy{menu\_bar}    \\
  2554.                                       &                & \idy{menu\_option}    \\
  2555.                                       &                & \idy{menu\_popup}    \\
  2556.                                       &                & \idy{menu\_pulldown}    \\
  2557.                                       &                & \idy{work\_area}    \\
  2558.   \idx{-spacing}                    & \cmd{3} or \cmd{0}
  2559.                                                       & \sym{Dimension}    \\
  2560.   \idx{-subMenuId}                    & \sym{none}    & \sym{Widget}    \\
  2561.   \idx{-whichButton}                &     computed    & \sym{Integer} \\
  2562. \end{rsrctable}
  2563. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2564. %----------------------------------------------------------------
  2565. \subsection{\cmd{xmForm}}
  2566. \titles{\cmd{xmForm}}
  2567. \index{xmform@\cmd{xmForm}}
  2568. A form is a manager widget, created to layout widgets 
  2569. using neighbourhood relationship, such as ``this widget 
  2570. should be positionned at the left of this one''.
  2571. This is quit general, and enable to define widgets that may resize gracefully.
  2572. The following exemple gives illustrate this~:
  2573.         \window{UserForm}
  2574. This constraints are defined in terms of attachment of each side
  2575. of children widgets to the form border, to another widget, to
  2576. a relative position in the form, or to the initial position
  2577. of the child.
  2578. When a resizing occurs, children are adjusted according to this
  2579. constraints.
  2580. \subsubsection*{Resources}
  2581. \begin{rsrctable}{xmForm}
  2582.   \idx{-fractionBase}            &     \cmd{100}    & \sym{Integer}    \\
  2583.   \idx{-horizontalSpacing}        &    \cmd{0}        & \sym{Dimension} \\
  2584.   \idx{-rubberPositioning}        &    \cmd{False}    & \sym{Boolean} \\
  2585.   \idx{-verticalSpacing}        &    \cmd{0}        & \sym{Dimension} \\
  2586.   \index{attachment@\cmd{-}\sym{side}\cmd{Attachment}}
  2587.   \index{leftattachment@\cmd{-leftAttachment}}
  2588.   \index{rightattachment@\cmd{-rightAttachment}}
  2589.   \index{topattachment@\cmd{-topAttachment}}
  2590.   \index{bottomattachment@\cmd{-bottomAttachment}}
  2591.   \cmd{-}\sym{side}\cmd{Attachment}    & \cmd{attach\_none}
  2592.                                                   & \idy{attach\_form} \\
  2593.                                   &                & \idy{attach\_none} \\
  2594.                                   &                & \idy{attach\_opposite\_form} \\
  2595.                                   &                & \idy{attach\_opposite\_widget} \\
  2596.                                   &                & \idy{attach\_position} \\
  2597.                                   &                & \idy{attach\_self} \\
  2598.                                   &                & \idy{attach\_widget} \\
  2599.   \index{offset@\cmd{-}\sym{side}\cmd{Offset}}
  2600.   \index{leftoffset@\cmd{-leftOffset}}
  2601.   \index{rightoffset@\cmd{-rightOffset}}
  2602.   \index{topoffset@\cmd{-topOffset}}
  2603.   \index{bottomoffset@\cmd{-bottomOffset}}
  2604.   \cmd{-}\sym{side}\cmd{Offset}    &     \cmd{0}        & \sym{Integer} \\
  2605.   \index{position@\cmd{-}\sym{side}\cmd{Position}}
  2606.   \index{leftposition@\cmd{-leftPosition}}
  2607.   \index{rightposition@\cmd{-rightPosition}}
  2608.   \index{topposition@\cmd{-topPosition}}
  2609.   \index{bottomposition@\cmd{-bottomPosition}}
  2610.   \cmd{-}\sym{side}\cmd{Position}&     \cmd{0}        & \sym{Integer} \\
  2611.   \index{widget@\cmd{-}\sym{side}\cmd{Widget}}
  2612.   \index{leftwidget@\cmd{-leftWidget}}
  2613.   \index{rightwidget@\cmd{-rightWidget}}
  2614.   \index{topwidget@\cmd{-topWidget}}
  2615.   \index{bottomwidget@\cmd{-bottomWidget}}
  2616.   \cmd{-}\sym{side}\cmd{Widget}    & \sym{none}    & \sym{Widget} \\
  2617. \end{rsrctable}
  2618. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2619. %----------------------------------------------------------------
  2620. \subsection{\cmd{xmPanedWindow}}
  2621. \titles{\cmd{xmPanedWindow}}
  2622. \index{xmpannedwindow@\cmd{xmPanedWindow}}
  2623. A panned window is a composite widget used to layout several children 
  2624. vertically, each in its own pane.
  2625. Pane sepators have a handle to interactively change the amont of vertical space
  2626. given to each children.
  2627.     \window{paned_window}
  2628. \subsubsection*{Resources}
  2629. \begin{rsrctable}{xmPanedWindow}
  2630.   \idx{-marginHeight}                &    \cmd{3}        & \sym{Dimension}    \\
  2631.   \idx{-marginWidth}                &    \cmd{3}        & \sym{Dimension}    \\
  2632.   \idx{-refigureMode}                &    \cmd{True}    & \sym{Boolean}     \\
  2633.   \idx{-sahsHeight}                    &    \cmd{10}    & \sym{Dimension}   \\
  2634.   \idx{-sashIndent}                    &    \cmd{-10}   & \sym{Dimension}   \\
  2635.   \idx{-sashShadowThikness}            & \sym{dynamic}    & \sym{Dimension}   \\
  2636.   \idx{-sahsWidth}                    &    \cmd{10}    & \sym{Dimension}   \\
  2637.   \idx{-separatorOn}                &    \cmd{True}    & \sym{Boolean}       \\
  2638.   \idx{-spacing}                    &    \cmd{8}        & \sym{Dimension}   \\
  2639. \end{rsrctable}
  2640. \begin{description}
  2641. \item[\cmd{-refigureMode}:]
  2642.     The children should be reseted to their appropriate positions when
  2643.     the paned window is resized.
  2644. \end{description}
  2645. \begin{center}\begin{tabular}{|l|c|l|}
  2646.   \hline%--------------------------------------------------------------------------
  2647.   \cmd{xmPanedWindow} Constraint & \\
  2648.                     resource name    & default value & type or legal values \\
  2649.   \hline%--------------------------------------------------------------------------
  2650.   \idx{-allowResize}                &    \cmd{True}    & \sym{Boolean}     \\
  2651.   \idx{-paneMaximum}                &    \cmd{1000}    & \sym{Dimension}   \\
  2652.   \idx{-paneMimimum}                &    \cmd{1}        & \sym{Dimension}   \\
  2653.   \idx{-skipAdjust}                    &    \cmd{False}    & \sym{Boolean}       \\
  2654.   \hline%--------------------------------------------------------------------------
  2655. \end{tabular}\end{center}
  2656. \cmd{-skipAdjust} : The paned window should not automatically resize this
  2657. pane.
  2658. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2659. %----------------------------------------------------
  2660. \section{Drag and Drop}
  2661. \label{sec:dragdrop}
  2662. \titles{Drag and Drop}
  2663. \index{drag and drop@Drag and Drop}
  2664. \index{cut and paste@Cut and Paste|see Drag and Drop}
  2665. \index{dragstart@\sym{w} \cmd{dragStart} \sym{rsrc} \sym{value} ...}
  2666. \index{dropsiteregister@\sym{w} \cmd{dropSiteRegister} \sym{rsrc} \sym{value} ...}
  2667. Drag and drop was introduced into \Motif\ 1.2. It is complicated. We shall
  2668. first look at the drop side. A widget has to first register itself as a
  2669. drop site, so that when an attempt is made to drop something on it, it will
  2670. try to handle it. 
  2671. This registration is done by the widget method \idx{dropSiteRegister}. 
  2672. This registration must include \Tcl\ code to be executed
  2673. when a drop is attempted, and this is done using the resource \idx{-dropProc}. 
  2674. The first part of what makes D\&D hard is that you have potentially two
  2675. different applications attempting to communicate, one dropping and the
  2676. other accepting the drop. 
  2677. A protocol is needed between these, so that they share a common language. 
  2678. This is done in registration by saying what types
  2679. of protocol are used, and how many there are. This is done using X atoms,
  2680. and the major ones are \cmd{COMPOUND\_TEXT}, \cmd{TEXT} and \cmd{STRING}. 
  2681. Thus registration is done, for example, by
  2682. \begin{tclmode}
  2683.     .l dropSiteRegister \
  2684.         -dropProc {startDrop %dragContext} \
  2685.         -numImportTargets 1 \
  2686.         -importTargets COMPOUND_TEXT
  2687. \end{tclmode}
  2688. \index{numimporttargets@\cmd{-numImportTargets}}
  2689. \index{importtargets@\cmd{-importTargets}}
  2690. This allows \cmd{.l} to be used as a drop site, 
  2691. accepting \cmd{COMPOUND\_TEXT} only.
  2692. Multiple types are allowed, using the Motif list structure of elements
  2693. separated by commas as in \cmd{"COMPOUND\_TEXT, TEXT, STRING"}.
  2694. When a drop occurs, the procedure \cmd{startDrop} is called, 
  2695. with one substituted parameter. 
  2696. This parameter is a \cmd{dragContext}, which is a widget created to
  2697. by \Motif\ to handle the drag part of all this. You must include this
  2698. parameter, or the next stage doesn't get off the ground.
  2699. When a drag actually occurs, \Motif\ creates a \cmd{dragContext} widget. 
  2700. A drag is started by holding down the middle button in a drag source, 
  2701. which is discussed later. 
  2702. The \cmd{dragContext} widget contains information about the drag
  2703. source, which is to be matched up against where the drop occurs. 
  2704. When the drop occurs, by releasing  the middle button, 
  2705. the \Tcl\ code registered as \cmd{dropProc} is executed. 
  2706. This should have the \cmd{dragContext} widget as parameter.
  2707. This code may try to determine if the drop should go ahead, but more
  2708. normally will just act as a channel through to the actual information
  2709. transfer. 
  2710. Still here~? Good~! 
  2711. The \cmd{dragProc} doesn't actually do the information transfer, 
  2712. it just determines whether or not it is possible, 
  2713. and if it is, what protocols should be used, and how.
  2714. The drop receiver may decide that it wants something encoded as \cmd{TEXT},
  2715. followed by something encoded as \cmd{COMPOUND\_TEXT}, 
  2716. and then by something in \cmd{STRING} format (beats me why, though...). 
  2717. it signals this by a (\Tcl) list of
  2718. dropTransfer pairs, consisting of the protocol (as an X atom name) and the
  2719. widget that is being dropped on. Huh? Why the widget that is being dropped
  2720. on? Because when a drop on a widget takes place, this is actually dealt
  2721. with by the dragContext widget, and this is about to hand the transfer over
  2722. to a transferWidget. Yes, I know you are using \Tcl\ because you couldn't
  2723. handle triple indirections (or rather, don't want too!), but they occur
  2724. anyway... So here is a simple dragProc:
  2725. \begin{tclmode}
  2726.     proc startDrop {dragContext} {
  2727.         $dragContext dropTransferStart \
  2728.             -dropTransfers {{COMPOUND_TEXT .l}} \
  2729.             -numDropTransfers 1 \
  2730.             -transferProc {doTransfer %closure {%value}}    
  2731. \end{tclmode}
  2732. \index{droptransfers@\cmd{-dropTransfers}}
  2733. \index{numdroptransfers@\cmd{-numDropTransfers}}
  2734. \index{transferproc@\cmd{-transferProc}}
  2735. The dragContext widget uses the command \idx{dropTransferStart} to signal 
  2736. the beginning of the information transfer 
  2737. (it could also signal that the drop is to terminate, with no
  2738. information transfer).  It will accept one chunk of information in the
  2739. \cmd{COMPOUND\_TEXT} format, and pass this on to the \cmd{.l} widget.
  2740. The information transfer is actually carried on by the Tcl procedure in the
  2741. transferProc resource. The only formats currently accepted (because they
  2742. are hard-coded into \Tm) are \cmd{COMPOUND\_TEXT}, \cmd{TEXT} and 
  2743. \cmd{STRING}.
  2744. The \cmd{transferProc} resource is a function that is called when the drop
  2745. receiver actually gets the information dropped on it. This should take at
  2746. least two parameters. The \idx{\%value} is substituted for the actual 
  2747. information dropped on it, and \idx{\%closure} is the second element in 
  2748. the dropTransfer list
  2749. which should be the widget the drop is happening on. 
  2750. (Why not let \Tm\ determine this? I dunno. Consistency with \Motif\ doco? 
  2751. Brain damage late at night?) 
  2752. Then the dropped on widget can take suitable action. This function
  2753. resets the label to the text dropped on it:
  2754. \begin{tclmode}
  2755.     proc doTransfer {destination value} {
  2756.          $destination setValues -labelString $value
  2757. \end{tclmode}
  2758. \noindent
  2759. where destination is substituted by \cmd{\%closure} and value by 
  2760. \cmd{\%value}.
  2761. \vfill\pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2762. %----------------------------------------------------
  2763. \section{Send}
  2764. \Tk\ has a primitive called \cmd{send}.
  2765. In this, each interpreter has a name, and you can send \Tcl\ commands from
  2766. one interpreter to another.
  2767. When an interpreter receives a sent command it executes it,
  2768. and returns any result back to the original interpreter.
  2769. This mechanism is also available to \Tm\, so that Motif applications can
  2770. set commands to other Motif applications, and also to and from \Tk\ ones.
  2771. If a \Tm\ application succeeds in registering its name,
  2772. from then on, it can send to another. For example,
  2773. \begin{tclmode}
  2774.     send interp2 {puts stdout "hello there"}
  2775. \end{tclmode}
  2776. instructs ``interp2'' to display a message.
  2777. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2778. %----------------------------------------------------
  2779. \section{More Widgets}
  2780. \label{sec:complex}
  2781. %-------------------------------------------------
  2782. \subsection{\cmd{xmCommand}}
  2783. \titles{\cmd{xmCommand}}
  2784. \index{xmcommand@\cmd{xmCommand}}
  2785. A command widget is composed of an history area (a \cmd{xmScrolledList}), 
  2786. a label to display the prompt, and a text field to edit the
  2787. current command.
  2788. The command widget is a sub-class of \cmd{xmSelectionBox}.
  2789. You are able to add an extra child, called the work area.
  2790. In the example below, this was used to add a button bar~:
  2791.         \window{command}
  2792. \subsubsection*{Methods}
  2793. The command widget recognize a few new methods~:
  2794. \begin{description}
  2795. \indexeditem{appendvalue}{\sym{cmd} \cmd{appendValue} \sym{command}}
  2796.     Append \sym{cmd} to the string already in the text field.  The
  2797.     string will be truncated before the first \cmd{\\n} encontered.
  2798. \indexeditem{error}{\sym{cmd} \cmd{error} \sym{error\_message}}
  2799.     Temporalily display the \sym{error\_message} at the bottom of
  2800.     the history area. It will automatically disapear once the
  2801.     user entered another command.
  2802. \indexeditem{setvalue}{\sym{cmd} \cmd{setValue} \sym{command}}
  2803.     Replace the string in the text field by \sym{command}.
  2804.     The old command is not entered in the history.
  2805. \end{description}
  2806. \subsubsection*{Resources}
  2807. \begin{rsrctable}{xmCommand}
  2808.   \idx{-command}                &    \cmd{""}    & \sym{String} \\
  2809.   \idx{-historyItems}            &    \cmd{""}    & \sym{String Table} \\
  2810.   \idx{-historyItemCount}        &    \cmd{0}        & \sym{Integer} \\
  2811.   \idx{-historyMaxItems}        &    \cmd{100}    & \sym{Integer} \\
  2812.   \idx{-historyVisibleItemCount}&   \cmd{8}     & \sym{Integer} \\
  2813.   \idx{-promptString}           &   \cmd{">"}   & \sym{String} \\
  2814. \end{rsrctable}
  2815. Other ones are inherited from \cmd{xmSelectionBox} and its ancestors.
  2816. \subsubsection*{Callbacks}
  2817. \begin{center}\begin{tabular}{|l|l|}
  2818. \hline %------------------------------------------------------------------
  2819.                     Method name    & Why \\
  2820. \hline %------------------------------------------------------------------
  2821.    \idx{commandChangedCallback}    & The current command changed (you type a key in)\\
  2822.    \idx{commandEnteredCallback}    & The command was entered (return key) \\
  2823. \hline %------------------------------------------------------------------
  2824. \end{tabular}\end{center}
  2825. Both of this callbacks suport the \idx{\%value} and \idx{\%length} 
  2826. substitution, which are replaced by the string (or string length) that 
  2827. fired the callback.
  2828. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2829. %-------------------------------------------------
  2830. \subsection{\cmd{xmDrawingArea} and \cmd{xmDrawnButton}}
  2831. \label{sec:drawn}
  2832. \titles{Drawn widgets}
  2833. \index{xmdrawingarea@\cmd{xmDrawingArea}}
  2834. \index{xmdrawingbutton@\cmd{xmDrawnButton}}
  2835. \index{xlib drawing@\Xlib\ drawing}
  2836. \index{getgc@\sym{w} \cmd{getGC} \sym{rsrc} \sym{value} ...}
  2837. \Tm\ (version \tmVersion) have a very limited support for \Xlib\ drawable area 
  2838. or buttons~: you can only draw string on them.
  2839. \subsubsection*{Drawing methods}
  2840. To manipulate such a widget, the currently defined methods are~:
  2841. \begin{description}
  2842.     \indexeditem{drawimagestring}{\sym{w} \cmd{drawImageString} \sym{gc} \sym{x} \sym{y} \sym{string}}
  2843.         Use the given graphical context \sym{gc} to draw the string \sym{string}
  2844.         starting at position \sym{x},\sym{y}.
  2845.         The 0,0 coordinate is at the upper-left of the widget.
  2846.         For instance, the following code produce an hello widget~:
  2847. \begin{tclmode}
  2848.     xmDrawingArea .top managed
  2849.     .top exposeCallback {
  2850.         set gc [.top getGC -foreground black]
  2851.         .top drawImageString $gc 10 10 "Hello World"
  2852. \end{tclmode}
  2853.         Note that it is necessary to use an \cmd{exposeCallback} to get
  2854.         the message redisplayed when needed.
  2855. \end{description}
  2856. \subsubsection*{Resources}
  2857. \begin{rsrctable}{xmDrawningArea}
  2858.   \idx{-marginHeight}                &    \cmd{10}    & \sym{Dimension}    \\
  2859.   \idx{-marginWidth}                &    \cmd{10}    & \sym{Dimension}    \\
  2860.   \idx{-resizePolicy}                & \cmd{resize\_any}
  2861.                                                       & \idy{resize\_any} \\
  2862.                                       &                & \idy{resize\_grow} \\
  2863.                                       &                & \idy{resize\_none} \\
  2864. \end{rsrctable}
  2865. \begin{rsrctable}{xmDrawnButton}
  2866.   \idx{-multiClick}                    & Inherited from display
  2867.                                                     & \idy{multiclick\_discard} \\
  2868.                                     &               & \idy{multiclick\_keep} \\
  2869.   \idx{-pushButtonEnabled}            &    \cmd{False}    & \sym{Boolean} \\
  2870.   \idx{-shadowType}                    & \cmd{shadow\_out}
  2871.                                                       & \idy{shadow\_in}    \\
  2872.                                     &                & \idy{shadow\_out}    \\
  2873.                                     &                & \idy{shadow\_etched\_in}\\
  2874.                                     &                & \idy{shadow\_etched\_out}\\
  2875. \end{rsrctable}
  2876. \subsubsection*{Callbacks}
  2877. \begin{center}\begin{tabular}{|l|l|}
  2878. \hline %------------------------------------------------------------------
  2879.                     Method name    & Why \\
  2880. \hline %------------------------------------------------------------------
  2881.            \idx{exposeCallback}    & The area/button should be redrawn \\
  2882.             \idx{inputCallback}    & A keyboard oy mouse event arrived for the area.\\
  2883.            \idx{resizeCallback}    & The area/button is resized \\
  2884.          \idx{acticateCallback}    & The button was activated \\
  2885.               \idx{armCallback}    & The button is squashed \\
  2886.            \idx{disarmCallback}    & The button is released \\
  2887. \hline %------------------------------------------------------------------
  2888. \end{tabular}\end{center}
  2889. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2890. %------------------------
  2891. \subsection{\cmd{xmMainWindow}}
  2892. \titles{\cmd{xmMainWindow}}
  2893. \index{xmmainwindow@\cmd{xmMainWindow}}
  2894. This composit widget is to be used for the main window of an application.
  2895. As you add child to it (a \cmd{xmMenuBar}, a \cmd{xmCommandWindow}, 
  2896. a \cmd{xmMessageBox}, a work area, \cmd{xmScrollBar}(s), ...)
  2897. it manage them, as you could do manually with a \cmd{xmForm}.
  2898. The management of the work area is not imediat~: the main window should
  2899. know which of is son is the work area widget before you can manage this 
  2900. child.
  2901. The following example will produce a prototype interface of
  2902. a standard application~:
  2903.     \ttinclude{examples/main.tcl}
  2904. \subsubsection*{Resources}
  2905. This widget defines the following resources
  2906. (renaming resources of its parents)~:
  2907. \begin{rsrctable}{xmMainWindow}
  2908.   \idx{-commandWindow}                & \sym{none}    & \sym{Widget} \\
  2909.   \idx{-commandWindowLocation}        & above            & \idy{command\_above\_workspace} \\
  2910.                                     &                & \idy{command\_below\_workspace} \\
  2911.   \idx{-mainWindowMarginHeight}        &    \cmd{0}        & \sym{Dimension}    \\
  2912.   \idx{-mainWindowMarginWidth}        &    \cmd{0}        & \sym{Dimension}    \\
  2913.   \idx{-menuBar}                    & \sym{none}    & \sym{Widget} \\
  2914.   \idx{-messageWindow}                & \sym{none}    & \sym{Widget} \\
  2915.   \idx{-showSeparator}                &    \cmd{False}    & \sym{Boolean} \\
  2916. \end{rsrctable}
  2917. \subsubsection*{Callbacks}
  2918. \begin{center}\begin{tabular}{|l|l|}
  2919. \hline %------------------------------------------------------------------
  2920.                     Method name    & Why \\
  2921. \hline %------------------------------------------------------------------
  2922.    \idx{commandChangedCallback}    & You type a key in, recall an history item, ... \\
  2923.    \idx{commandEnteredCallback}    & \cmd{<key>Enter}, double-click, ...  \\
  2924.                \idx{focusCallback}    & The window get focus. \\
  2925.                  \idx{mapCallback}    & The window was mapped on screen. \\
  2926.                \idx{unmapCallback}    & The window was unmapped. \\
  2927. \hline %------------------------------------------------------------------
  2928. \end{tabular}\end{center}
  2929. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2930. \section{Boxes}
  2931. \label{sec:boxes}
  2932. Boxes are complex widgets with a work area, and a line of buttons.
  2933. They are designed to handle common layout of 
  2934. several more basic widgets.
  2935. Boxes might be used as is, or as building blocks of more 
  2936. complex interfaces.
  2937. They are also often used inside {\em dialog} (standalone windows),
  2938. see section~\ref{sec:Dialogs}.
  2939. %----------------------------------------------------------
  2940. \subsection{\cmd{xmMessageBox}}
  2941. \titles{\cmd{xmMessageBox}}
  2942. \index{xmmessagebox@\cmd{xmMessageBox}}
  2943. Message box are used to display simple messages.
  2944. \cmd{xmMessageBox} may also display a symbol (pixmap) to show warnings,
  2945. error conditions, ...
  2946. This may be done by setting the \cmd{-dialogType} resource, or by
  2947. specifying a pixmap (\cmd{-symbolPixmap}), as in the following
  2948. example~:
  2949.     \window{message}
  2950. \medskip
  2951. A message box is a composite widget, whose component children might be managed
  2952. or unmanaged. This is done using the usual \Tm\ commands \cmd{manageChild} and
  2953. \cmd{unmanageChild} applyed on the automatically derived children objects.
  2954. If the message box is named \sym{w}, the known childrens are~:
  2955. \begin{center}\begin{tabular}{lll}
  2956.     \sym{w}\cmd{.Cancel}    & \sym{w}\cmd{.Help}        & \sym{w}\cmd{.Message} \\
  2957.     \sym{w}\cmd{.OK}        & \sym{w}\cmd{.Separator}    & \sym{w}\cmd{.Symbol}
  2958. \end{tabular}\end{center}
  2959. The next example start a \cmd{xmMessageBox}, then drops unwanted features
  2960. (buttons and the separator line), then add an icon, and finally manage it.
  2961. \begin{tclmode}
  2962.     xmMessageBox .message \
  2963.         -messageString "Some simple message"
  2964.     foreach child {OK Cancel Help Separator} {
  2965.         .message.$child unmanageChild
  2966.     .message.Symbol setValues -labelPixmap face
  2967.     .message manageChild
  2968. \end{tclmode}
  2969. \subsubsection*{Resources}
  2970. \begin{rsrctable}{xmMessageBox}
  2971.   \idx{-cancelLabelString}            & \cmd{"Cancel"}    & \sym{String} \\
  2972.   \idx{-defaultButtonType}            & \cmd{dialog\_ok\_button}
  2973.                                                         & \idy{dialog\_cancel\_button} \\
  2974.                                     &                    & \idy{dialog\_help\_button} \\
  2975.                                     &                    & \idy{dialog\_ok\_button} \\
  2976.   \idx{-dialogType}                    & \cmd{dialog\_message}
  2977.                                                         & \idy{dialog\_error} \\
  2978.                                     &                    & \idy{dialog\_information} \\
  2979.                                     &                    & \idy{dialog\_message} \\
  2980.                                     &                    & \idy{dialog\_question} \\
  2981.                                     &                    & \idy{dialog\_warning} \\
  2982.                                     &                    & \idy{dialog\_working} \\
  2983.   \idx{-helpLabelString}            & \cmd{"Help"}        & \sym{String} \\
  2984.   \idx{-messageAlignment}            & \cmd{alignment\_beginning}
  2985.                                                         & \idy{alignment\_center} \\
  2986.                                     &                    & \idy{alignment\_beginning} \\
  2987.                                     &                    & \idy{alignment\_end} \\
  2988.   \idx{-messageString}                &    \cmd{""}        & \sym{String} \\
  2989.   \idx{-minimizeButtons}            &  \cmd{False}        & \sym{Boolean} \\
  2990.   \idx{-okLabelString}                &    \cmd{"Ok"}        & \sym{String} \\
  2991.   \idx{-symbolPixmap}                & depend of \cmd{-dialogType}
  2992.                                                         & \sym{Pixmap} \\
  2993.   \hline%---------------------------------------------------------------------
  2994. \end{rsrctable}
  2995.  \subsubsection*{Callbacks}
  2996. \begin{center}\begin{tabular}{|l|l|}
  2997. \hline %------------------------------------------------------------------
  2998.                 Method name    & Why \\
  2999. \hline %------------------------------------------------------------------
  3000.        \idx{cancelCallback}    & The cancel button was activated \\
  3001.          \idx{helpCallback}    & The help button was activated, or an Help action arise. \\
  3002.            \idx{okCallback}    & The ok button was activated \\
  3003.            \idx{focusCallback}    & The window get focus. \\
  3004.              \idx{mapCallback}    & The window was mapped on screen. \\
  3005.            \idx{unmapCallback}    & The window was unmapped. \\
  3006. \hline %------------------------------------------------------------------
  3007. \end{tabular}\end{center}
  3008. Furthermore, \cmd{xmMessageBox} also inherits \cmd{destroyCallback}
  3009. from \cmd{Core}.
  3010. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3011. %-----------------------------------------------------
  3012. \subsection{\cmd{xmSelectionBox}}
  3013. \titles{\cmd{xmSelectionBox}}
  3014. \label{sec:xmSelectionBox}
  3015. \index{xmselectionbox@\cmd{xmSelectionBox}}
  3016. \window{select}
  3017. A selection box is a composit box designed to ease creation of interfaces 
  3018. that enable the user to choose one (or several) items from a list.
  3019. A selection box has a number of component children, 
  3020. which may be managed or unmanaged by the application.
  3021. These children widgets are often managed or unmanaged
  3022. to add or remove elements from a dialog. \Motif\ gives no information about
  3023. types of these widgets, so managing and unmanaging are really the only two
  3024. operations that you should perform on these widgets.
  3025. The corresponding \Tcl\ commands are automatically created when the master
  3026. command is created.
  3027. If the SelectionBox is named \sym{w}, they are~:
  3028. \begin{center}\begin{tabular}{ll}
  3029.     \sym{w}\cmd{.Apply}        & \sym{w}\cmd{.OK} \\
  3030.     \sym{w}\cmd{.Cancel}    & \sym{w}\cmd{.Selection} \\
  3031.     \sym{w}\cmd{.Help}        & \sym{w}\cmd{.Separator} \\
  3032.     \sym{w}\cmd{.ItemsList}    & \sym{w}\cmd{.Text} \\
  3033.     \sym{w}\cmd{.Items}        & \\
  3034. \end{tabular}\end{center}
  3035. \begin{center}\begin{tabular}{|l|l|}
  3036. \hline %------------------------------------------------------------------
  3037.                 Method name    & Why \\
  3038. \hline %------------------------------------------------------------------
  3039.       \idx{applyCallback}    & The Apply button is released. \\
  3040.      \idx{cancelCallback}    & The Cancel button is released. \\
  3041.          \idx{okCallback}    & The Ok button is released. \\
  3042.     \idx{noMatchCallback}    & Nothing match the selection expression. \\
  3043. \hline %------------------------------------------------------------------
  3044. \end{tabular}\end{center}
  3045. The selection box widget also inherits all the callbacks defined in 
  3046. \cmd{xmList}, and in \cmd{xmText}.
  3047. % Selection Box
  3048.     \idx{\%length}
  3049.     \idx{\%value}
  3050. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3051. \subsection{\cmd{xmFileSelectionBox}}
  3052. \titles{\cmd{xmFileSelectionBox}}
  3053. \label{sec:xmFileSelectionBox}
  3054. \index{xmfileselectionbox@\cmd{xmFileSelectionBox}}
  3055. \window{fileselect}
  3056. The file selection box is designed to let the user interactively specify 
  3057. a directory and a file. 
  3058. A filter may be used to display only certain files, based on a regular 
  3059. expression matching their name.
  3060. \begin{center}\begin{tabular}{lll}
  3061.     \sym{w}\cmd{.Apply}        & \sym{w}\cmd{.FilterLabel}    & \sym{w}\cmd{.Items}    \\
  3062.     \sym{w}\cmd{.Cancel}    & \sym{w}\cmd{.FilterText}    & \sym{w}\cmd{.OK}        \\
  3063.     \sym{w}\cmd{.DirList}    & \sym{w}\cmd{.Help}        & \sym{w}\cmd{.Selection} \\
  3064.     \sym{w}\cmd{.Dir}        & \sym{w}\cmd{.ItemsList}    & \sym{w}\cmd{.Separator} \\
  3065.     \sym{w}\cmd{.Text} \\
  3066. \end{tabular}\end{center}
  3067. \subsubsection*{Resources}
  3068. \begin{rsrctable}{xmFileSelectionBox}
  3069. \end{rsrctable}
  3070. \subsubsection*{Callbacks}
  3071. \begin{center}\begin{tabular}{|l|l|}
  3072. \hline %------------------------------------------------------------------
  3073.                     Method name    & Why \\
  3074. \hline %------------------------------------------------------------------
  3075. \hline %------------------------------------------------------------------
  3076. \end{tabular}\end{center}
  3077. % xmFileSelectionBox
  3078.     \idx{\%value}
  3079.     \idx{\%value\_length}
  3080.     \idx{\%mask}
  3081.     \idx{\%mask\_length}
  3082.     \idx{\%dir}
  3083.     \idx{\%dir\_length}
  3084.     \idx{\%pattern}
  3085.     \idx{\%pattern\_length}
  3086. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3087. \section{Menus}
  3088. \label{sec:menus}
  3089. \titles{Menus}
  3090. \index{menus@Menus}
  3091. %\window{menus}
  3092. Menus are ...
  3093. In \Motif, this is done by using separate widgets for all the actors~:
  3094. \begin{description}
  3095. \item[A \bf menu bar~:]\dopar
  3096.     that might be used to group (horizontally by default) several menu
  3097.     buttons.
  3098.     This will be described in the \cmd{xmMenuBar} section.
  3099. \item[\bf menu buttons~:]\dopar
  3100.     A special subtype of \cmd{xmPushButton} that automatically popup
  3101.     a pulldown menu. When this widget is created as a child of another
  3102.     popup menu, (hence in a cascading submenu), a small arrows is added
  3103.     at the right of the label.
  3104.     This will be described in the \cmd{xmCascadeButton} section.
  3105. \item[the \bf pulldown menu~:]
  3106.     This a special king of \cmd{xmRowColumn} widget, intented to hold
  3107.     several buttons (and separators) vertically.
  3108.     This will be described in the next section.
  3109. \end{description}
  3110. %----------------------------------------------------------
  3111. \subsection{\cmd{xmPulldownMenu}}
  3112. \titles{\cmd{xmPulldownMenu}}
  3113. \index{xmpulldownmenu@\cmd{xmPulldownMenu}}
  3114. \index{popup menu@Popup menu |see \cmd{xmPulldownMenu}}
  3115. A pulldown menu is a special kind of vertical \cmd{xmRowColumn}.
  3116. It is managed only when it should be displayed.
  3117. Pulldown or cascading menu are managed when the user clik on some 
  3118. \cmd{xmCascadeButton}.
  3119. Popup menu are managed by a more 
  3120. general event, typicaly through a defined translation of the main window.
  3121. Menu items are child wid\-gets (\cmd{xmLabel}, buttons, \cmd{xmSeparator}, or
  3122. \cmd{xm\-Cascade\-Button}). 
  3123. The order of definition gives the item order.
  3124. \begin{center}\begin{tabular}{|l|l|}
  3125. \hline %------------------------------------------------------------------
  3126.                 Method name    & Why \\
  3127. \hline %------------------------------------------------------------------
  3128.       \idx{popupCallback}    & The menu is managed and mapped. \\
  3129.     \idx{popdownCallback}    & The menu is un-mapped. \\
  3130. \hline %------------------------------------------------------------------
  3131. \end{tabular}\end{center}
  3132. %------------------------
  3133. \subsection{\cmd{xmCascadeButton}}
  3134. \titles{\cmd{xmCascadeButton}}
  3135. \index{xmcascadebutton@\cmd{xmCascadeButton}}
  3136. The cascade button is a subclass of the usual push button 
  3137. (\cmd{xmPushButton}, page~\pageref{class:xmPushButton}) that force 
  3138. management of a pulldown menu.
  3139. \begin{rsrctable}{xmCascadeButton}
  3140.     \idx{-windowId}        &    \sym{none}    & \sym{Widget} \\
  3141. \end{rsrctable}
  3142. %------------------------
  3143. \subsection{\cmd{xmMenuBar}}
  3144. \titles{\cmd{xmMenuBar}}
  3145. \index{xmmenubar@\cmd{xmMenuBar}}
  3146. A menu bar is an ``ever displayed horizontal pulldown menu'', that may 
  3147. only contain cascade buttons.
  3148. It is used to permanently display the buttons that trigger the pulldown 
  3149. menus of an application (for instance at the top of a \cmd{xmMainWindow}).
  3150. %------------------------
  3151. \subsection{Exotic menus}
  3152. \titles{Exotic menus}
  3153. Examples for a left menu bar, that is always managed
  3154. A pulldown menu in a dialog, that start to be displayed at the current setting.
  3155. A menu that display icons. (A suitable bushes of push buttons) ?
  3156. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3157. %------------------------------------------------------------
  3158. \section{Dialogs}
  3159. \label{sec:Dialogs}
  3160. \titles{dialog widgets}
  3161. Dialogs are widgets that appear in their own window on the screen,
  3162. when they are managed.
  3163. Usually, they are {\em modeless}~:
  3164. interactions continue with all visible widgets, while they are visible.
  3165. \moat does support the {\em modal} mode through the \idx{dialogStyle}
  3166. resource, when set to e.g. \idx{dialog\_full\_application\_modal}.
  3167. The modal interaction is exited when the dialog disappear, typically when 
  3168. the user have activated some push button.
  3169. %------------------------
  3170. \subsection{Simple informational dialogs}
  3171. \index{xmmessagedialog@\cmd{xmMessageDialog}},
  3172. \index{xminformationdialog@\cmd{xmInformationDialog}},
  3173. \index{xmworkingdialog@\cmd{xmWorkingDialog}},
  3174. \index{xmpromptdialog@\cmd{xmPromptDialog}},
  3175. \index{xmquestiondialog@\cmd{xmQuestionDialog}},
  3176. \index{xmwarningdialog@\cmd{xmWarningDialog}},
  3177. \index{xmerrordialog@\cmd{xmErrorDialog}}.
  3178.     \window{errorBox}
  3179. The simplest dialogs are message boxes in a dialog, with an optional icon.
  3180. The predefined icons are~:
  3181. \begin{center}
  3182.     \begin{tabular}{|c|c|c|}
  3183.         \hline
  3184.         \windowdump{information} & \windowdump{working} & \windowdump{prompt}  \\
  3185.         information & working & prompt  \\
  3186.         \hline
  3187.         \windowdump{question} & \windowdump{warning} & \windowdump{error}  \\
  3188.         question & warning & error  \\
  3189.         \hline
  3190.     \end{tabular}
  3191. \end{center}
  3192. \Tm\ defines the following \Tcl\ commands to create this dialogs~:
  3193.     \cmd{xmMessageDialog},
  3194.      \cmd{xmInformationDialog},
  3195.     \cmd{xmWorkingDialog},
  3196.     \cmd{xmPromptDialog},
  3197.     \cmd{xmQuestionDialog},
  3198.     \cmd{xm\-War\-n\-ing\-Dialog},
  3199.     \cmd{xmErrorDialog}.
  3200. As for the corresponding message boxes, a particular child is accessible
  3201. with the specific \Tcl\ command.
  3202. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3203. \subsection{General manager dialogs}
  3204. \index{xmformdialog@\cmd{xmFormDialog}}
  3205. \index{xmbulletinboarddialog@\cmd{xmBulletinBoardDialog}}
  3206. The more general dialogs use the two multi-purpose managers inside.
  3207. \moat\ defines the following \cmd{xmFormDialog} and 
  3208. \cmd{xmBulletinBoardDialog} commands to create them.
  3209. %------------------------
  3210. \subsection{\cmd{xmSelectionDialog}}
  3211. \index{xmselectiondialog@\cmd{xmSelectionDialog}}
  3212. This is the standard \Motif\ dialog used to select an item.
  3213. See \cmd{xmSelectionBox} (page~\pageref{sec:xmSelectionBox}) for the 
  3214. corresponding box.
  3215. %------------------------
  3216. \subsection{\cmd{xmFileSelectionDialog}}
  3217. \index{xmfileselectiondialog@\cmd{xmFileSelectionDialog}}
  3218. This is the standard \Motif\ dialog used to select a directory and a file 
  3219. name.
  3220. See \cmd{xmFileSelectionBox} (page~\pageref{sec:xmFileSelectionBox}) for the 
  3221. corresponding box.
  3222. \pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3223. \appendix
  3224. {\small
  3225.     \titles{Index}
  3226.     \label{index}
  3227.     \printindex
  3228. \tableofcontents
  3229. \end{document}
  3230.